body.cs-sd-lock-scroll {
    overflow: hidden;
}

@font-face {
    font-family: 'CsSdSweetDiaryUser';
    src: url('assets/QianTuXiaoTuTi-2.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'CsSdSweetDiaryChar';
    src: url('assets/QingSongShouXieTi1-2.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* 须高于 .couple-space-overlay（z-index:100135），否则从私密空间打开时界面叠在主层之下 */
/* 由 couple-space-sweet-diary.js 挂载在 #app 下；用 absolute+inset0 贴齐 love 咪小手机外框，勿用 fixed 铺整个浏览器 */
.cs-sd-overlay {
    position: absolute;
    inset: 0;
    z-index: 100230;
    display: none;
    box-sizing: border-box;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    /* 与 #app 屏幕四边各 8px；刘海/横条时取与 safe-area 的较大者 */
    padding: max(8px, env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    background: #1a0d06;
}

.cs-sd-overlay.is-open {
    display: flex;
}

.cs-sd-shell {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    background: #1a0d06;
    box-shadow: 0 0 60px rgba(0,0,0,0.8), inset 0 0 0 1px rgba(255,200,100,0.08);
    position: relative;
}

/* ── 视图切换（翻页动画替代原 opacity+translate） ── */
.cs-sd-cover-view,
.cs-sd-inside-view {
    position: absolute;
    inset: 0;
}

.cs-sd-cover-view {
    opacity: 1;
    transform: perspective(1200px) rotateY(0deg);
    transform-origin: left center;
    pointer-events: auto;
    transition: none;
}

.cs-sd-inside-view {
    opacity: 0;
    transform: perspective(1200px) rotateY(90deg);
    transform-origin: left center;
    pointer-events: none;
    background: linear-gradient(180deg, #fffaf5, #fffdf9 42%, #fff8f3 100%);
    transition: none;
}

.cs-sd-overlay.is-inside .cs-sd-cover-view {
    opacity: 0;
    transform: perspective(1200px) rotateY(-90deg);
    pointer-events: none;
}

.cs-sd-overlay.is-inside .cs-sd-inside-view {
    opacity: 1;
    transform: perspective(1200px) rotateY(0deg);
    pointer-events: auto;
}

/* 翻页动画 keyframes — 模拟真实书页翻开：先慢后快翻出，先快后慢落入 */
@keyframes cs-sd-flip-cover-out {
    0%   { transform: perspective(1400px) rotateY(0deg)   translateZ(0px);   opacity: 1; }
    30%  { transform: perspective(1400px) rotateY(-28deg) translateZ(8px);   opacity: 0.95; }
    70%  { transform: perspective(1400px) rotateY(-72deg) translateZ(4px);   opacity: 0.5; }
    100% { transform: perspective(1400px) rotateY(-90deg) translateZ(0px);   opacity: 0; }
}
@keyframes cs-sd-flip-inside-in {
    0%   { transform: perspective(1400px) rotateY(90deg)  translateZ(0px);   opacity: 0; }
    30%  { transform: perspective(1400px) rotateY(62deg)  translateZ(4px);   opacity: 0.5; }
    70%  { transform: perspective(1400px) rotateY(22deg)  translateZ(8px);   opacity: 0.95; }
    100% { transform: perspective(1400px) rotateY(0deg)   translateZ(0px);   opacity: 1; }
}
@keyframes cs-sd-flip-inside-out {
    0%   { transform: perspective(1400px) rotateY(0deg)   translateZ(0px);   opacity: 1; }
    30%  { transform: perspective(1400px) rotateY(28deg)  translateZ(8px);   opacity: 0.95; }
    70%  { transform: perspective(1400px) rotateY(72deg)  translateZ(4px);   opacity: 0.5; }
    100% { transform: perspective(1400px) rotateY(90deg)  translateZ(0px);   opacity: 0; }
}
@keyframes cs-sd-flip-cover-in {
    0%   { transform: perspective(1400px) rotateY(-90deg) translateZ(0px);   opacity: 0; }
    30%  { transform: perspective(1400px) rotateY(-62deg) translateZ(4px);   opacity: 0.5; }
    70%  { transform: perspective(1400px) rotateY(-22deg) translateZ(8px);   opacity: 0.95; }
    100% { transform: perspective(1400px) rotateY(0deg)   translateZ(0px);   opacity: 1; }
}

/* 翻向内页 */
.cs-sd-overlay.is-flipping-out .cs-sd-cover-view {
    animation: cs-sd-flip-cover-out 0.42s cubic-bezier(0.55,0,0.85,0.5) forwards;
    transform-origin: left center;
    pointer-events: none;
}
.cs-sd-overlay.is-flipping-in-inside .cs-sd-inside-view {
    animation: cs-sd-flip-inside-in 0.46s cubic-bezier(0.15,0.5,0.45,1) forwards;
    transform-origin: left center;
    pointer-events: auto;
    opacity: 0;
}

/* 翻回封面 */
.cs-sd-overlay.is-flipping-back-out .cs-sd-inside-view {
    animation: cs-sd-flip-inside-out 0.42s cubic-bezier(0.55,0,0.85,0.5) forwards;
    transform-origin: left center;
    pointer-events: none;
}
.cs-sd-overlay.is-flipping-back-in .cs-sd-cover-view {
    animation: cs-sd-flip-cover-in 0.46s cubic-bezier(0.15,0.5,0.45,1) forwards;
    transform-origin: left center;
    pointer-events: auto;
    opacity: 0;
}

/* ── 封面顶栏（悬浮在封面上） ── */
.cs-sd-topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 10px;
    background: transparent;
}

.cs-sd-page-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 10px;
}

.cs-sd-back,
.cs-sd-nav-btn {
    border: 0;
    background: rgba(0,0,0,0.38);
    color: #e8c87a;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.cs-sd-page-topbar .cs-sd-back {
    background: rgba(255,255,255,0.85);
    color: #8e58d2;
    box-shadow: 0 10px 24px rgba(157,78,221,0.16);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.cs-sd-nav-btn:disabled {
    opacity: .38;
    box-shadow: none;
}

.cs-sd-page-nav {
    display: flex;
    gap: 10px;
}

.cs-sd-topbar-spacer {
    width: 38px;
    height: 38px;
}

/* ── 封面舞台：铺满整个 cover-view ── */
.cs-sd-cover-stage {
    position: absolute;
    inset: 0;
    padding: 0;
    perspective: 1200px;
}

/* ── 复古皮革封面 ── */
.cs-sd-cover-book {
    position: absolute;
    inset: 0;
    border-radius: 0;
    /* 深棕牛皮：磨损色斑 + 皮纹细纹 + 边角反光 */
    background:
        /* 左上角磨亮反光 */
        radial-gradient(ellipse at 8% 6%,  rgba(200,140,80,0.38) 0%, transparent 22%),
        /* 右上角暗部 */
        radial-gradient(ellipse at 88% 8%,  rgba(30,10,2,0.55)   0%, transparent 26%),
        /* 中央偏左磨损亮斑 */
        radial-gradient(ellipse at 22% 38%, rgba(160,90,40,0.42) 0%, transparent 28%),
        /* 中央大面积磨损 */
        radial-gradient(ellipse at 55% 52%, rgba(120,60,20,0.28) 0%, transparent 38%),
        /* 左下角磨损 */
        radial-gradient(ellipse at 12% 82%, rgba(170,95,38,0.35) 0%, transparent 24%),
        /* 右下角暗部 */
        radial-gradient(ellipse at 85% 90%, rgba(25,8,2,0.48)    0%, transparent 28%),
        /* 皮纹：斜向细纹（模拟压纹） */
        repeating-linear-gradient(
            -38deg,
            transparent 0px, rgba(0,0,0,0.055) 1px,
            transparent 2px, rgba(0,0,0,0.018) 5px,
            transparent 9px
        ),
        repeating-linear-gradient(
            52deg,
            transparent 0px, rgba(255,255,255,0.022) 1px,
            transparent 5px
        ),
        /* 底色：深巧克力棕，中心稍亮模拟皮革光泽 */
        radial-gradient(ellipse at 38% 28%, #6b3318 0%, #4a2008 30%, #321408 60%, #1e0c06 100%);
    box-shadow:
        inset 0 0 80px rgba(0,0,0,0.5),
        inset 4px 0 14px rgba(0,0,0,0.7),
        inset -2px 0 8px rgba(0,0,0,0.3),
        inset 0 -4px 20px rgba(0,0,0,0.4);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* 书脊（左侧深色竖条，软壳皮革折叠感） */
.cs-sd-cover-book::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 22px;
    background: linear-gradient(90deg,
        #080402 0%,
        #120804 40%,
        #1e0e06 70%,
        #2e1608 100%);
    box-shadow: 4px 0 12px rgba(0,0,0,0.6), 8px 0 24px rgba(0,0,0,0.25);
    z-index: 2;
}

/* 书口（右侧金色页边，做旧感） */
.cs-sd-cover-book::after {
    content: '';
    position: absolute;
    right: 0;
    top: 4px;
    bottom: 4px;
    width: 6px;
    background: repeating-linear-gradient(
        to bottom,
        #b89038 0px, #d4aa48 1px, #a07828 2px, #c89840 3px
    );
    opacity: 0.85;
    border-radius: 0 1px 1px 0;
    z-index: 2;
}

/* 自定义封面图 */
.cs-sd-cover-book.has-custom-cover {
    background: none !important;
    background-color: #2a1208 !important;
}

.cs-sd-cover-custom-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    pointer-events: none;
    z-index: 0;
}

/* 封面光泽层 — 模拟软壳皮革高光与暗部 */
.cs-sd-cover-book-glow {
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        /* 左上角高光（皮革折叠反光） */
        radial-gradient(ellipse at 15% 10%, rgba(255,210,140,0.18) 0%, transparent 38%),
        /* 右侧中部暗部 */
        radial-gradient(ellipse at 92% 50%, rgba(0,0,0,0.22) 0%, transparent 40%),
        /* 底部暗部 */
        radial-gradient(ellipse at 50% 95%, rgba(0,0,0,0.28) 0%, transparent 45%),
        /* 中央微弱光泽 */
        radial-gradient(ellipse at 42% 35%, rgba(255,190,100,0.07) 0%, transparent 50%);
    pointer-events: none;
}

/* ── 皮革绑带 ── */
.cs-sd-cover-strap {
    position: absolute;
    left: 22px;
    right: 6px;
    height: 32px;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 16px;
}

.cs-sd-cover-strap-top    { top: 27%; }
.cs-sd-cover-strap-bottom { top: 60%; }

.cs-sd-cover-strap::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        /* 顶部高光边缘 */
        linear-gradient(180deg,
            rgba(200,130,60,0.32) 0%,
            rgba(200,130,60,0.10) 18%,
            transparent 40%,
            transparent 60%,
            rgba(0,0,0,0.12) 82%,
            rgba(0,0,0,0.22) 100%
        ),
        /* 皮纹细纹 */
        repeating-linear-gradient(
            -38deg,
            transparent 0px, rgba(0,0,0,0.07) 1px,
            transparent 2px, rgba(0,0,0,0.025) 5px,
            transparent 9px
        ),
        /* 绑带底色：比封面稍深，做旧感 */
        linear-gradient(180deg, #5a2610 0%, #4a1e0a 35%, #3c1808 55%, #4a1e0a 100%);
    box-shadow:
        0 6px 14px rgba(0,0,0,0.6),
        0 -3px 6px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(220,150,70,0.28),
        inset 0 -1px 0 rgba(0,0,0,0.45);
}

/* 绑带左侧铆钉（做旧铜钉） */
.cs-sd-cover-strap::after {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 32% 28%, #c8a050 0%, #8a6420 45%, #5a3e10 75%, #3a2808 100%);
    box-shadow:
        0 2px 4px rgba(0,0,0,0.6),
        inset 0 1px 0 rgba(255,220,120,0.3),
        inset 0 -1px 0 rgba(0,0,0,0.4);
    z-index: 1;
}

/* 做旧古铜方形扣环 */
.cs-sd-cover-strap-buckle {
    position: relative;
    z-index: 2;
    width: 34px;
    height: 24px;
    border-radius: 3px;
    background: linear-gradient(145deg,
        #7a6020 0%,
        #5e4818 30%,
        #4a3810 55%,
        #6a5418 80%,
        #7e6422 100%);
    box-shadow:
        0 3px 8px rgba(0,0,0,0.65),
        0 1px 3px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(200,160,60,0.35),
        inset 0 -1px 0 rgba(0,0,0,0.5),
        inset 1px 0 0 rgba(180,140,50,0.2),
        inset -1px 0 0 rgba(0,0,0,0.3);
    /* 做旧氧化感：外框深色描边 */
    outline: 1.5px solid rgba(30,18,4,0.7);
    outline-offset: -1px;
}

/* 扣环中间竖销 */
.cs-sd-cover-strap-buckle::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 18px;
    background: linear-gradient(180deg,
        #8a6e24 0%,
        #6a5018 40%,
        #4e3c10 60%,
        #6a5018 100%);
    border-radius: 2px;
    box-shadow:
        1px 0 2px rgba(0,0,0,0.5),
        -1px 0 1px rgba(180,140,50,0.2),
        inset 0 1px 0 rgba(220,180,70,0.3);
}

/* 扣环内框镂空效果（左右两个矩形孔） */
.cs-sd-cover-strap-buckle::after {
    content: '';
    position: absolute;
    inset: 4px 8px;
    border-radius: 1px;
    box-shadow:
        inset 0 0 0 1.5px rgba(0,0,0,0.55),
        inset 0 1px 3px rgba(0,0,0,0.4);
    background: rgba(0,0,0,0.25);
}

/* ── 两绑带之间的中央羊皮纸标签 ──
 * 上沿 = 上绑带下缘（.cs-sd-cover-strap-top: top:28% + height:24px）；
 * 下沿 = 下绑带上缘（.cs-sd-cover-strap-bottom: top:62%）→ bottom:38% */
.cs-sd-cover-mid {
    position: absolute;
    left: 20px;
    right: 7px;
    top: calc(28% + 24px);
    bottom: calc(100% - 62%);
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 14px;
    /* 羊皮纸纹理：横向纤维丝 + 纵向细纹 + 色斑 */
    background:
        repeating-linear-gradient(
            91deg,
            rgba(160,110,40,0)    0px, rgba(160,110,40,0.055) 1px,
            rgba(160,110,40,0)    2px, rgba(160,110,40,0.025) 5px,
            rgba(160,110,40,0)    9px
        ),
        repeating-linear-gradient(
            1deg,
            rgba(120,80,20,0)     0px, rgba(120,80,20,0.04)  1px,
            rgba(120,80,20,0)     3px, rgba(120,80,20,0.018) 7px,
            rgba(120,80,20,0)     12px
        ),
        radial-gradient(ellipse at 28% 22%, rgba(230,200,130,0.55) 0%, rgba(0,0,0,0) 48%),
        radial-gradient(ellipse at 72% 78%, rgba(185,145,70,0.45)  0%, rgba(0,0,0,0) 42%),
        radial-gradient(ellipse at 55% 48%, rgba(210,175,100,0.3)  0%, rgba(0,0,0,0) 38%),
        linear-gradient(180deg, #ddc88a 0%, #d2bc78 22%, #c8ae68 55%, #c0a45e 80%, #cab06a 100%);
    box-shadow:
        4px 0 16px rgba(0,0,0,0.42),
        -4px 0 16px rgba(0,0,0,0.42),
        inset 0 0 28px rgba(150,100,30,0.14);
    pointer-events: auto;
}

/* ── 封面标题与副标题（位于中央带内） ── */
.cs-sd-cover-title {
    position: relative;
    z-index: 6;
    border: 0;
    background: transparent;
    color: rgba(60,30,8,0.92);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 4px;
    text-align: center;
    white-space: nowrap;
    text-shadow: 0 1px 0 rgba(255,220,120,0.3);
    max-width: 100%;
    padding: 0 4px;
}

.cs-sd-cover-subtitle {
    position: relative;
    z-index: 6;
    color: rgba(60,30,8,0.55);
    font-size: 10px;
    line-height: 1.6;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
}

/* 上传按钮 */
.cs-sd-cover-upload {
    position: absolute;
    right: 22px;
    bottom: 22px;
    min-width: 48px;
    min-height: 48px;
    padding: 8px;
    margin: 0;
    border: 0;
    background: rgba(0,0,0,0.35);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    z-index: 5;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.cs-sd-cover-upload:focus { outline: none; }
.cs-sd-cover-upload:focus-visible {
    outline: 2px solid rgba(232,200,122,0.6);
    outline-offset: 4px;
}
.cs-sd-cover-upload:active {
    opacity: 0.82;
    transform: scale(0.94);
}

.cs-sd-cover-open-hit {
    position: absolute;
    inset: 0;
    border: 0;
    background: transparent;
    z-index: 2;
}
.cs-sd-cover-open-hit:focus { outline: none; }

.cs-sd-cover-upload-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.cs-sd-cover-upload img {
    width: 48px;
    height: 48px;
    display: block;
    object-fit: contain;
    filter: brightness(1.4);
}

/* ── 封面操作菜单 ── */
.cs-sd-cover-action-menu {
    display: none;
    position: absolute;
    right: 14px;
    bottom: 82px;
    z-index: 20;
    flex-direction: column;
    gap: 8px;
    min-width: 130px;
}
.cs-sd-cover-action-menu.is-open { display: flex; }

.cs-sd-cover-action-item,
.cs-sd-cover-action-cancel {
    border: 0;
    border-radius: 14px;
    padding: 12px 18px;
    font-size: 14px;
    text-align: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
    cursor: pointer;
}
.cs-sd-cover-action-item {
    background: rgba(255,255,255,0.18);
    color: #fff;
}
.cs-sd-cover-action-item.is-add {
    background: rgba(232,200,122,0.22);
    color: #f5d98a;
}
.cs-sd-cover-action-cancel {
    background: rgba(255,255,255,0.10);
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    margin-top: 4px;
}
.cs-sd-cover-action-item:active,
.cs-sd-cover-action-cancel:active { opacity: 0.75; }

/* ── 内页 ── */
.cs-sd-page-no {
    font-size: 14px;
    color: #9b77c6;
    letter-spacing: 1px;
}

.cs-sd-page-wrap {
    padding: 0;
    height: calc(100% - 66px);
    position: relative;
}

/* ===== 正反面翻转容器 ===== */
.cs-sd-flip-container {
    perspective: 1400px;
    transform-style: preserve-3d;
    position: relative;
}

.cs-sd-flip-front,
.cs-sd-flip-back {
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 20px 22px;
    box-sizing: border-box;
    will-change: transform;
}

.cs-sd-flip-front {
    position: relative;
    transform-origin: left center;
    transition: transform 0.72s cubic-bezier(0.42, 0, 0.28, 1.0);
}

.cs-sd-flip-back {
    transform: rotateY(180deg);
    transform-origin: left center;
    position: absolute;
    inset: 0;
    transition: transform 0.72s cubic-bezier(0.42, 0, 0.28, 1.0);
}

/* 翻到背面 */
.cs-sd-flip-container.is-flipped .cs-sd-flip-front {
    transform: rotateY(-180deg);
}
.cs-sd-flip-container.is-flipped .cs-sd-flip-back {
    transform: rotateY(0deg);
}

/* 右下角卷曲动画 */
@keyframes cs-sd-page-curl {
    0%   { opacity: 0; width: 0;    height: 0; }
    25%  { opacity: 1; width: 44px; height: 44px; }
    65%  { opacity: 1; width: 68px; height: 68px; }
    100% { opacity: 0; width: 0;    height: 0; }
}

.cs-sd-flip-container.is-turning .cs-sd-flip-front::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background: conic-gradient(from 225deg at 100% 100%,
        rgba(80,40,140,0.20) 0deg,
        rgba(80,40,140,0.07) 50deg,
        transparent 90deg);
    border-radius: 0 0 24px 0;
    animation: cs-sd-page-curl 0.72s cubic-bezier(0.42, 0, 0.28, 1.0) forwards;
}

.cs-sd-flip-back-footer {
    display: flex;
    justify-content: center;
    padding: 14px 0 8px;
    flex-shrink: 0;
}

.cs-sd-flip-front-footer {
    display: flex;
    justify-content: center;
    padding: 14px 0 8px;
    flex-shrink: 0;
}

.cs-sd-flip-to-back-btn,
.cs-sd-flip-to-front-btn {
    font-size: 14px;
    padding: 8px 28px;
}

.cs-sd-flip-back .cs-sd-waiting-reply {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a68bbc;
    font-size: 15px;
    text-align: center;
}

.cs-sd-page-date {
    font-size: 15px;
    color: #6f588f;
    letter-spacing: .6px;
}

.cs-sd-page-host,
.cs-sd-page-host-back {
    flex: 1;
    min-height: 0;
}

.cs-sd-lined-paper {
    height: 100%;
    overflow: auto;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,252,248,0.98));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 16px 34px rgba(183,151,215,0.18);
    scrollbar-color: rgba(157,78,221,0.35) transparent;
    scrollbar-width: thin;
}

.cs-sd-lined-paper::-webkit-scrollbar { width: 6px; }
.cs-sd-lined-paper::-webkit-scrollbar-thumb {
    background: rgba(157,78,221,0.35);
    border-radius: 999px;
}

.cs-sd-lined-paper-track {
    position: relative;
    min-height: 100%;
    box-sizing: border-box;
}

.cs-sd-lined-paper-lines {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    border-radius: inherit;
    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0, transparent 32px,
            #E9E7F5 32px, #E9E7F5 33px,
            transparent 33px, transparent 65px,
            #FFF3F3 65px, #FFF3F3 66px,
            transparent 66px, transparent 98px
        ),
        repeating-linear-gradient(
            to right,
            transparent 0, transparent 32px,
            #FFF3F3 32px, #FFF3F3 33px,
            transparent 33px, transparent 65px,
            #E9E7F5 65px, #E9E7F5 66px,
            transparent 66px, transparent 98px
        );
    background-size:
        100% 98px,
        98px 100%;
    background-position: 0 0;
}

.cs-sd-lined-paper-lines::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background-image:
        repeating-linear-gradient(
            to bottom,
            transparent 0, transparent 48.5px,
            #E9E7F5 48.5px, #E9E7F5 49.5px,
            transparent 49.5px, transparent 98px
        ),
        repeating-linear-gradient(
            to right,
            transparent 0, transparent 48.5px,
            #FFF3F3 48.5px, #FFF3F3 49.5px,
            transparent 49.5px, transparent 98px
        );
    background-size:
        4px 98px,
        98px 4px;
}

.cs-sd-lined-paper-content {
    position: relative;
    z-index: 1;
    padding: 12px 18px 26px;
}

.cs-sd-lined-paper-content.is-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    text-align: center;
    color: #a68bbc;
    font-size: 15px;
    line-height: 2.2;
}

.cs-sd-page-tip { max-width: 250px; }

.cs-sd-entry-divider {
    width: 100%;
    max-width: min(100%, 300px);
    height: 48px;
    margin: 8px auto 20px;
    flex-shrink: 0;
    background: linear-gradient(100deg, #fbcfe8 0%, #f5d0fe 35%, #d8b4fe 65%, #c084fc 100%);
    -webkit-mask-image: url('love-mi-logo.png');
    mask-image: url('love-mi-logo.png');
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.cs-sd-entry-card {
    position: relative;
    z-index: 1;
    margin-bottom: 26px;
    padding: 6px 0 0;
}

.cs-sd-entry-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.cs-sd-entry-author {
    font-size: 16px;
    font-weight: 700;
    color: #7f4fc0;
}

.cs-sd-comment-btn {
    border: 0;
    background: rgba(157,78,221,0.1);
    color: #8a58ce;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
}

.cs-sd-entry-body {
    font-size: 15px;
    line-height: 2.2;
    color: #58446f;
    white-space: normal;
    word-break: break-word;
}

.cs-sd-entry-card.is-user .cs-sd-entry-body {
    font-family: 'CsSdSweetDiaryChar', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    color: #5B7493;
}
.cs-sd-entry-card.is-char .cs-sd-entry-body {
    font-family: 'CsSdSweetDiaryChar', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    color: #191A1B;
}
.cs-sd-entry-card.is-user .cs-sd-comment-text {
    font-family: 'CsSdSweetDiaryChar', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
.cs-sd-entry-card.is-char .cs-sd-comment-text {
    font-family: 'CsSdSweetDiaryChar', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.cs-sd-entry-comments {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cs-sd-entry-comments-empty,
.cs-sd-comment {
    font-size: 12px;
    line-height: 1.6;
    color: #8f7ba6;
    background: rgba(255,255,255,0.7);
    border-radius: 14px;
    padding: 8px 10px;
}

.cs-sd-comment-author {
    font-weight: 700;
    color: #8152c1;
    margin-right: 6px;
}

/* ── 模态框 ── */
.cs-sd-modal {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(94,54,129,0.26);
    z-index: 30;
}

.cs-sd-modal.is-open { display: flex; }

.cs-sd-modal-panel {
    width: min(100%, 340px);
    border-radius: 24px;
    background: #fff;
    padding: 22px 18px 18px;
    box-shadow: 0 18px 44px rgba(93,57,132,0.24);
}

.cs-sd-modal-title {
    font-size: 17px;
    font-weight: 700;
    color: #7351a5;
    margin-bottom: 14px;
}

.cs-sd-modal-input,
.cs-sd-modal-textarea {
    width: 100%;
    border: 1px solid rgba(157,78,221,0.18);
    border-radius: 16px;
    padding: 12px 14px;
    font-size: 14px;
    color: #4e3c67;
    background: rgba(249,245,255,0.8);
    resize: none;
}

.cs-sd-modal-textarea { min-height: 220px; line-height: 1.7; }
.cs-sd-modal-textarea.is-comment { min-height: 120px; }

.cs-sd-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.cs-sd-modal-btn {
    border: 0;
    border-radius: 999px;
    padding: 9px 16px;
    font-size: 13px;
}

.cs-sd-modal-btn.is-ghost {
    background: rgba(157,78,221,0.08);
    color: #8155bf;
}

.cs-sd-modal-btn.is-primary {
    background: linear-gradient(135deg, #bb81ff, #9b5ef0);
    color: #fff;
}

/* ── 翻页动画（上一页/下一页） ── */
@keyframes cs-sd-turn-out-next {
    0%   { transform: perspective(1200px) rotateY(0deg)   translateX(0);    opacity: 1; }
    40%  { transform: perspective(1200px) rotateY(-25deg) translateX(-8px); opacity: 0.7; }
    100% { transform: perspective(1200px) rotateY(-90deg) translateX(-20px);opacity: 0; }
}
@keyframes cs-sd-turn-in-next {
    0%   { transform: perspective(1200px) rotateY(90deg)  translateX(20px); opacity: 0; }
    60%  { transform: perspective(1200px) rotateY(20deg)  translateX(6px);  opacity: 0.8; }
    100% { transform: perspective(1200px) rotateY(0deg)   translateX(0);    opacity: 1; }
}
@keyframes cs-sd-turn-out-prev {
    0%   { transform: perspective(1200px) rotateY(0deg)   translateX(0);    opacity: 1; }
    40%  { transform: perspective(1200px) rotateY(25deg)  translateX(8px);  opacity: 0.7; }
    100% { transform: perspective(1200px) rotateY(90deg)  translateX(20px); opacity: 0; }
}
@keyframes cs-sd-turn-in-prev {
    0%   { transform: perspective(1200px) rotateY(-90deg) translateX(-20px);opacity: 0; }
    60%  { transform: perspective(1200px) rotateY(-20deg) translateX(-6px); opacity: 0.8; }
    100% { transform: perspective(1200px) rotateY(0deg)   translateX(0);    opacity: 1; }
}

.cs-sd-page-wrap.is-turning-next {
    animation: cs-sd-turn-out-next 0.18s cubic-bezier(0.55,0,1,0.45) forwards;
    pointer-events: none;
}
.cs-sd-page-wrap.is-turning-in-next {
    animation: cs-sd-turn-in-next 0.28s cubic-bezier(0,0.55,0.45,1) forwards;
    pointer-events: none;
}
.cs-sd-page-wrap.is-turning-prev {
    animation: cs-sd-turn-out-prev 0.18s cubic-bezier(0.55,0,1,0.45) forwards;
    pointer-events: none;
}
.cs-sd-page-wrap.is-turning-in-prev {
    animation: cs-sd-turn-in-prev 0.28s cubic-bezier(0,0.55,0.45,1) forwards;
    pointer-events: none;
}
