/* ═══════════════════════════════════════════════════════════
   心语 App (Whisper) — 完整样式表
   对齐「心语二改」HTML 参考版
   字体通过 WhisperApp._injectFonts() 动态加载
   ═══════════════════════════════════════════════════════════ */

/* ── CSS 变量（字体在 JS 中通过 <link> 加载） ── */
:root {
    --w-bg: #f2efe9;
    --w-paper: #fffdf8;
    --w-cover: #7b8c9c;
    --w-cover-dark: #5c6b7a;
    --w-cover-current: #7b8c9c;
    --w-metal: #d4b886;
    --w-text-dark: #36302e;
    --w-text-sub: #a39995;
    --w-ink-black: #111111;
    --w-heart-red: #c96a68;
    --w-font-sans: 'Inter', -apple-system, sans-serif;
    --w-font-serif: 'Noto Serif SC', serif;
    --w-font-hand: 'Caveat', cursive;
    --w-font-sign: 'Ma Shan Zheng', serif;
    --w-font-mono: 'Courier Prime', monospace;
}

#app-whisper * { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent; }

.whisper-root {
    width: 100%;
    height: 100%;
    max-width: 430px;
    margin: 0 auto;
    background: var(--w-bg);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: background-color 0.8s ease;
}

/* 动态光绘粒子背景 */
.whisper-root::before, .whisper-root::after {
    content: ''; position: absolute; border-radius: 50%; filter: blur(40px); opacity: 0.35; pointer-events: none; z-index: 0; animation: floatOrb 10s infinite alternate;
}
.whisper-root::before { width: 200px; height: 200px; background: var(--w-cover); top: -50px; left: -50px; }
.whisper-root::after { width: 300px; height: 300px; background: rgba(255,255,255,0.6); bottom: -100px; right: -100px; animation-delay: -5s; }
@keyframes floatOrb { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(30px, 30px) scale(1.2); } }

/* ════ 视图切换 ════ */
.view {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    transition: 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    opacity: 0;
    pointer-events: none;
}
.view.active { opacity: 1; pointer-events: auto; }
#view-home { z-index: 20; }
#view-home.opening {
    opacity: 0;
    pointer-events: none;
    transition-delay: 0.3s;
}
/* 🔧 修复：阅读视图打开时 view-home 虽 opacity:0 仍盖在上层（z-index:20），
   且 .w-back-home / .char-selector 自己 pointer-events:auto 会反向覆盖父级的 none，
   导致点详情页"‹"实际点到隐形的回桌面按钮，从详情页直接回到桌面。
   opening 状态下强制禁用所有子元素交互，确保点击穿透到下面的 view-reading。 */
#view-home.opening,
#view-home.opening * {
    pointer-events: none !important;
}

/* ════ 首页 ════ */
.whisper-header {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    padding: 0;
    z-index: 2;
    pointer-events: none;
}
.whisper-header::before {
    content: 'MEMORIES';
    position: absolute;
    top: 120px; left: 20px;
    font-family: var(--w-font-serif);
    font-size: 60px; font-weight: 900;
    color: rgba(0,0,0,0.03);
    letter-spacing: 5px;
    pointer-events: none;
}

.w-back-home {
    position: absolute;
    left: 20px;
    top: calc(max(env(safe-area-inset-top, 0px), var(--safe-top, 0px)) + 20px);
    min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px;
    color: var(--w-text-dark);
    background: none; border: none;
    cursor: pointer;
    pointer-events: auto;
    z-index: 50;
}

.whisper-title {
    position: absolute;
    top: calc(max(env(safe-area-inset-top, 0px), var(--safe-top, 0px)) + 120px);
    left: 30px;
    font-family: var(--w-font-serif);
    font-size: 42px; font-weight: 900;
    color: var(--w-text-dark);
    line-height: 1.1; letter-spacing: 2px;
}

.whisper-sub {
    position: absolute;
    top: calc(max(env(safe-area-inset-top, 0px), var(--safe-top, 0px)) + 170px);
    left: 35px;
    font-size: 12px; letter-spacing: 8px;
    color: var(--w-cover);
    font-weight: bold;
    transition: color 0.8s;
}

.char-selector {
    position: absolute;
    bottom: calc(env(safe-area-inset-bottom, 20px) + 40px);
    left: 30px;
    background: #fff;
    padding: 8px 8px 25px 8px;
    border-radius: 4px;
    box-shadow: 2px 10px 25px rgba(0,0,0,0.08);
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    cursor: pointer; z-index: 10; pointer-events: auto;
    transform: rotate(-4deg);
    transition: transform 0.3s;
    border: 1px solid #f0f0f0;
}
.char-selector:active { transform: rotate(0deg) scale(0.95); }

.char-info { display: flex; align-items: center; gap: 12px; }

.char-avatar {
    width: 70px; height: 70px;
    border-radius: 2px;
    object-fit: cover;
    background: var(--w-cover);
    transition: background 0.4s;
}

.char-name {
    font-family: var(--w-font-hand);
    font-size: 24px;
    color: var(--w-text-dark);
    line-height: 1;
}

.btn-switch { display: none; }

.book-container {
    position: absolute;
    top: 50%; right: -60px;
    transform: translateY(-50%);
    width: 240px; height: 60vh;
    z-index: 5;
    perspective: 1500px;
}

/* ── 本子封面 ── */
.journal-cover {
    width: 100%; height: 100%;
    background-color: var(--w-cover);
    background-image: url("data:image/svg+xml,%3Csvg width='4' height='4' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1h2v2H1z' fill='%23000' fill-opacity='0.05'/%3E%3C/svg%3E");
    border-radius: 12px 0 0 12px;
    position: relative;
    box-shadow: -20px 30px 50px rgba(0,0,0,0.2), inset 5px 0 15px rgba(255,255,255,0.2);
    cursor: pointer;
    transition: transform 0.4s ease, background-color 0.8s ease;
}
.journal-cover:active { transform: translateX(-15px); }
.journal-cover.is-open { transform: translateX(-15px); }

.cover-stamp {
    position: absolute;
    top: 40px; left: 20px;
    font-family: var(--w-font-serif);
    font-size: 28px;
    color: rgba(0,0,0,0.15);
    text-shadow: 1px 1px 0 rgba(255,255,255,0.2);
    writing-mode: vertical-rl;
    letter-spacing: 15px;
}

.journal-strap {
    position: absolute;
    left: -15px; top: 60%;
    transform: translateY(-50%);
    width: 60px; height: 25px;
    background: var(--w-cover-dark);
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    z-index: 5;
    transition: background-color 0.8s;
}

.journal-clasp {
    position: absolute;
    left: 5px; top: 50%;
    transform: translateY(-50%);
    width: 12px; height: 35px;
    background: linear-gradient(to bottom, #fff, var(--w-metal), #a68551);
    border-radius: 6px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.4);
}

.journal-label {
    position: absolute;
    bottom: 50px; left: 30px;
    background: #fff;
    padding: 10px 15px;
    border-radius: 2px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border: 2px solid var(--w-metal);
    display: flex; flex-direction: column; align-items: flex-start;
}

.label-title {
    font-size: 9px;
    color: var(--w-text-sub);
    margin-bottom: 2px;
    font-weight: bold;
    letter-spacing: 3px;
}

.label-sub {
    font-family: var(--w-font-sans);
    font-size: 18px; font-weight: 900;
    color: var(--w-text-dark);
    line-height: 1;
    transition: color 0.4s;
}

/* ════ 阅读视图背景 ════ */
#view-reading {
    z-index: 10;
    background-color: var(--w-bg);
}

.reading-header {
    padding: max(20px, env(safe-area-inset-top, 0px), var(--safe-top, 0px)) 20px 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 20;
    position: relative;
    flex-shrink: 0;
}

.whisper-back-btn,
.whisper-overview-btn {
    background: #fff;
    border: none;
    width: 44px; height: 44px;
    border-radius: 50%;
    font-size: 20px;
    color: var(--w-text-dark);
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.1s;
}
.whisper-back-btn:active,
.whisper-overview-btn:active { transform: scale(0.92); }

/* ── 旋转容器 ── */
.reading-book-area {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
    will-change: transform;
}

/* ── 铁线圈 ── */
.w-rings {
    position: absolute;
    top: 8px;
    left: calc(8vw + 8px);
    right: calc(8vw + 8px);
    height: 20px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    pointer-events: none;
    z-index: 30;
}
.w-ring {
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1), inset 1px 1px 2px #fff;
    border: 4px solid var(--w-metal);
}
.w-ring:nth-child(n+2):nth-child(-n+5) { display: none; }

/* ════ 轮播容器 ════ */
#whisper-carousel {
    flex: 1;
    display: flex;
    overflow: hidden;
    overflow-clip-margin: 20px;
    position: relative;
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
    min-height: 0;
    padding-top: 10px;
}
#whisper-carousel.grabbing { cursor: grabbing; }

#whisper-boxes {
    display: flex;
    transition: transform 0.35s ease-out;
    will-change: transform;
    align-items: stretch;
    width: 100%;
    min-height: 0;
}

.whisper-box {
    width: 100%;
    height: 100%;
    flex-shrink: 0;
    padding: 0 8vw 20px 8vw;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
    transition: transform 0.8s cubic-bezier(0.3, 1, 0.2, 1), opacity 0.8s;
    scroll-snap-align: center;
}
.whisper-box.side {
    opacity: 0.5;
    transform: scale(0.94);
}
.whisper-box.center {
    opacity: 1;
    transform: scale(1);
}
.whisper-box.tearing {
    transform: translateY(100vh) rotate(10deg);
    opacity: 0;
    pointer-events: none;
}

/* ════ 本子封皮 ════ */
.whisper-locket-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 0;
    background: var(--w-paper);
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: background-color 0.8s;
}
.whisper-locket-wrapper::before { display: none; }

/* ── 咖啡渍装饰 ── */
.coffee-stain {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 120px;
    height: 120px;
    background-image: radial-gradient(
        circle,
        transparent 40%,
        rgba(139,69,19,0.08) 50%,
        rgba(139,69,19,0.03) 60%,
        transparent 70%
    );
    border-radius: 50%;
    transform: scaleY(0.8) rotate(45deg);
    pointer-events: none;
    z-index: 0;
}
.coffee-stain::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    width: 90px;
    height: 90px;
    border: 2px solid rgba(139,69,19,0.06);
    border-radius: 50%;
}

/* ════ 白纸 ════ */
.diary-note-paper {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 0;
    z-index: 2;
    background: var(--w-paper);
    padding: 40px 25px;
    overflow: hidden;
    background-image: repeating-linear-gradient(transparent, transparent 31px, rgba(0,0,0,0.03) 32px);
    background-attachment: local;
}

/* ── 纸胶带 ── */
.top-tape {
    position: absolute;
    top: 15px; left: 30px;
    width: 40px; height: 15px;
    background: rgba(255,255,255,0.9);
    border: 1px solid #eee;
    z-index: 5;
    transform: rotate(-3deg);
    box-shadow: 1px 2px 4px rgba(0,0,0,0.05);
    pointer-events: none;
}

/* ── 爱心书签 ── */
.heart-bookmark {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    background: none;
    border: none;
    padding: 0;
}
.heart-bookmark svg {
    width: 26px;
    height: 26px;
    fill: transparent;
    stroke: #d0c8c9;
    stroke-width: 2px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.heart-bookmark.favorited svg {
    fill: var(--w-cover);
    stroke: var(--w-cover);
    animation: heart-beat 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 2px 8px var(--w-cover));
}
@keyframes heart-beat {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* ── 页面头部 ── */
.page-top {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-bottom: 15px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    padding-top: 10px;
}

.whisper-box-title {
    font-family: var(--w-font-serif);
    font-size: 22px;
    font-weight: 900;
    color: var(--w-text-dark);
    margin-bottom: 4px;
    padding-right: 40px;
    word-break: break-all;
}

.page-date {
    font-family: var(--w-font-sans);
    font-size: 12px;
    color: var(--w-text-sub);
    letter-spacing: 2px;
}

/* ── 纸张内容 ── */
.whisper-paper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    touch-action: pan-y;
    padding-bottom: 50px;
    position: relative;
    z-index: 2;
    font-family: var(--w-font-serif);
    font-size: 15px;
    color: var(--w-text-dark);
    line-height: 32px;
    -webkit-overflow-scrolling: touch;
}
.whisper-paper::-webkit-scrollbar { display: none; }
.whisper-paper p { margin-bottom: 0; text-indent: 2em; }

/* ── 签名 ── */
.signature,
.whisper-sign {
    display: block;
    text-align: right;
    margin-top: 40px;
    font-family: var(--w-font-sign);
    font-size: 28px;
    color: var(--w-ink-black);
    font-weight: normal;
    flex-shrink: 0;
    mix-blend-mode: multiply;
    transform: rotate(-2deg);
    opacity: 0.9;
}

/* ── 隐藏墨迹（可点击揭示） ── */
.smudged-ink {
    background: rgba(0,0,0,0.04);
    color: transparent;
    text-shadow: 0 0 10px rgba(45,52,62,0.4);
    cursor: pointer;
    transition: all 0.6s ease;
    user-select: none;
    border-radius: 4px;
    padding: 0 4px;
}
.smudged-ink.revealed {
    background: transparent;
    color: var(--w-text-dark);
    text-shadow: none;
    font-weight: bold;
}
.whisper-struck {
    text-decoration: line-through;
    color: var(--w-text-sub);
}

/* ════ 装饰物品容器 ════ */
.decor-items-container {
    margin: 30px 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ════ 纪念物翻转卡 ════ */
.flip-item-wrapper {
    width: 180px;
    height: 210px;
    transform: rotate(-2deg);
    cursor: pointer;
    position: relative;
    isolation: isolate;
    transition: transform 0.3s;
}
.flip-item-wrapper:hover { transform: rotate(0deg) scale(1.02); z-index: 10; }

/* 回形针 */
.flip-paperclip {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%) rotate(10deg);
    width: 14px;
    height: 36px;
    border: 2px solid var(--w-metal);
    border-bottom: none;
    border-radius: 7px;
    z-index: 10;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.flip-item-inner {
    width: 100%;
    height: 100%;
    /* 不用 3D/rotateY：rotateY 必然带一次水平镜像，能否"抵消"全看引擎实现 preserve-3d，
       移动端经常抵消失败 → 背面字镜像（实测过）。改用 scaleX 压扁做翻面动画：
       scaleX 全程不取负值，任何引擎、任何手机都不可能镜像文字。
       1 → 0（压成一条线、看不见）→ 1，在中点用 opacity 切换正反面 */
    transition: transform 0.3s ease-in;
    transform: scaleX(1);
    position: relative;
}
.flip-item-wrapper.is-flipped .flip-item-inner {
    transform: scaleX(1) scale(1.1);
    transition: transform 0.3s ease-out;
    z-index: 20;
}
/* 动画中点把卡片横向压扁到 0（侧立看不见），正反面切换发生在这一帧 */
.flip-item-wrapper.is-flipping .flip-item-inner {
    transform: scaleX(0);
}

.flip-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-radius: 2px;
    overflow: hidden;
    opacity: 1;
}
/* 翻面后显示背面：纯 opacity 决定可见面，scaleX 只管动画，坏了也只是没动画 */
.flip-item-wrapper.is-flipped .flip-face:not(.flip-back) { opacity: 0; }
.flip-item-wrapper.is-flipped .flip-back { opacity: 1; }

/* 卡片背面 */
.flip-back {
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    font-family: var(--w-font-sign);
    font-size: 20px;
    color: #111;
    font-weight: normal;
    line-height: 1.4;
    background: #fff;
    background-image: radial-gradient(rgba(0,0,0,0.03) 1px, transparent 1px);
    background-size: 10px 10px;
}
.candy-back { border-radius: 16px; }

/* 票据背面特殊样式 */
.flip-item-wrapper:has(.item-ticket) .flip-back {
    background: #fdf6e3;
    color: #5c4d47;
    font-family: var(--w-font-mono);
    font-size: 14px;
    font-weight: 600;
}

/* 磁带背面：标签纸 */
.flip-item-wrapper:has(.item-cassette) .flip-back {
    background: #f4ead6;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 27px,
        rgba(92,77,71,0.18) 27px,
        rgba(92,77,71,0.18) 28px
    );
    color: #4a3f39;
    font-family: var(--w-font-hand);
    font-size: 19px;
}

/* 信笺背面：信纸 */
.flip-item-wrapper:has(.item-letter) .flip-back {
    background: linear-gradient(160deg, #fbf6ee, #f3e9d8);
    color: #4a3f39;
    font-family: var(--w-font-sign);
    font-size: 19px;
}

/* ── 快照 ── */
.item-polaroid {
    background: #fff;
    padding: 5px 5px 15px;
    display: flex;
    flex-direction: column;
}
.item-polaroid .photo-area {
    flex: 1;
    background: linear-gradient(135deg, var(--w-cover), #fceee3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #fff;
    text-align: center;
    padding: 7px;
    font-family: var(--w-font-sans);
    letter-spacing: 1px;
}

/* ── 票根 ── */
.item-ticket {
    background: #fdf6e3;
    border: 1px solid #e0d8c8;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 8px;
    position: relative;
}
.item-ticket::before,
.item-ticket::after {
    content: '';
    position: absolute;
    left: -5px;
    top: 0;
    width: 10px;
    height: 100%;
    background: radial-gradient(circle at 0 10px, transparent 5px, #fdf6e3 6px) 0 0/10px 20px;
}
.item-ticket::after {
    left: auto;
    right: -5px;
    background: radial-gradient(circle at 10px 10px, transparent 5px, #fdf6e3 6px) 0 0/10px 20px;
}
.ticket-barcode {
    width: 72%;
    height: 28px;
    background: repeating-linear-gradient(
        90deg,
        #5c4d47 2px,
        transparent 2px,
        transparent 4px,
        #5c4d47 4px,
        #5c4d47 6px,
        transparent 6px,
        transparent 9px
    );
    margin-bottom: 6px;
    opacity: 0.65;
}
.ticket-text {
    font-family: var(--w-font-mono);
    font-size: 9px;
    color: var(--w-text-dark);
    letter-spacing: 2px;
    font-weight: 600;
}

/* ── 收据 ── */
.item-receipt {
    background: #fff;
    padding: 10px 7px;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: var(--w-font-mono);
    font-size: 9px;
    color: #333;
    line-height: 1.8;
    position: relative;
}
.item-receipt::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 10px;
    background:
        linear-gradient(-45deg, transparent 33.33%, #fff 33.33%, #fff 66.66%, transparent 66.66%),
        linear-gradient(45deg, transparent 33.33%, #fff 33.33%, #fff 66.66%, transparent 66.66%);
    background-size: 10px 20px;
}
.receipt-logo {
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 4px;
    border-bottom: 1px dashed #ccc;
    padding-bottom: 3px;
    width: 100%;
    text-align: center;
}

/* ── 糖纸 ── */
.item-candy {
    background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.6));
    border: 1px solid rgba(255,255,255,0.8);
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.05), inset 0 0 12px rgba(255,255,255,0.8);
    background-image:
        linear-gradient(45deg, rgba(255,182,193,0.4) 0%, rgba(173,216,230,0.4) 50%, rgba(255,255,224,0.4) 100%);
    position: relative;
    overflow: visible;
}
.item-candy::before,
.item-candy::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 40px;
    background: inherit;
    border: 1px solid rgba(255,255,255,0.6);
    z-index: -1;
}
.item-candy::before {
    left: -16px;
    clip-path: polygon(0 10%, 100% 40%, 100% 60%, 0 90%);
}
.item-candy::after {
    right: -16px;
    clip-path: polygon(100% 10%, 0 40%, 0 60%, 100% 90%);
}
.candy-text {
    font-family: var(--w-font-hand);
    font-size: 28px;
    font-weight: 700;
    color: var(--w-cover);
    text-shadow: 1px 1px 2px #fff;
    transform: rotate(-10deg);
    transition: color 0.4s;
}

/* ── 磁带 ── */
.item-cassette {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #3a3530, #2a2622);
    border: 1px solid #1c1916;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 14px;
}
.cassette-label {
    width: 100%;
    background: #f4ead6;
    color: #5c4d47;
    font-family: var(--w-font-mono);
    font-size: 11px;
    letter-spacing: 2px;
    text-align: center;
    padding: 6px 0;
    border-radius: 2px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}
.cassette-window {
    width: 80%;
    height: 46px;
    background: #d9d2c7;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.4);
}
.cassette-reel {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background:
        radial-gradient(circle, #2a2622 7px, transparent 8px),
        repeating-conic-gradient(#8a8178 0deg 30deg, #6b635b 30deg 60deg);
    box-shadow: 0 0 0 2px rgba(0,0,0,0.2);
}

/* ── 信笺 ── */
.item-letter {
    width: 100%;
    height: 100%;
    background: linear-gradient(160deg, #fbf6ee, #f3e9d8);
    border: 1px solid #e3d6c0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 18px;
    position: relative;
}
.letter-seal {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #d77a6b, #a83f30);
    color: #fbe9e3;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.25), inset 0 0 6px rgba(0,0,0,0.3);
}
.letter-lines {
    width: 70%;
    height: 30px;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 8px,
        #cdbfa6 8px,
        #cdbfa6 9px
    );
    opacity: 0.7;
}

/* ════ 删除按钮 ════ */
.whisper-delete-btn {
    align-self: center;
    background: none;
    border: none;
    color: #a89a94;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: 0.2s;
    padding: 10px;
    letter-spacing: 2px;
    margin-top: 10px;
    flex-shrink: 0;
}
.whisper-delete-btn:hover { color: #d9534f; }

/* ════ 锁链层 ════ */
.whisper-jewelry-layer {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
    overflow: hidden;
    border-radius: 8px 16px 16px 8px;
}
.is-locked .whisper-jewelry-layer {
    opacity: 1;
    pointer-events: auto;
}
.is-locked .diary-note-paper {
    filter: blur(4px) grayscale(0.5);
    opacity: 0.4;
    pointer-events: none;
    user-select: none;
}
.is-locked .whisper-paper,
.is-locked .page-top {
    user-select: none;
    pointer-events: none;
}

.whisper-fine-chain {
    position: absolute;
    top: 50%;
    left: -10px;
    right: -10px;
    height: 8px;
    background-image: radial-gradient(circle, var(--w-metal) 40%, transparent 50%);
    background-size: 12px 12px;
    background-repeat: repeat-x;
    transform: translateY(-50%);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
    transition: 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s;
}
.whisper-chain-l { transform: translateY(-20px) rotate(3deg); }
.whisper-chain-r { transform: translateY(20px) rotate(-3deg); }

.whisper-lock-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    z-index: 20;
    transition: 0.3s;
}
.whisper-mini-lock {
    position: relative;
    width: 44px;
    height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: 0.3s;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
}
.whisper-lock-container:hover .whisper-mini-lock { transform: scale(1.05); }

.whisper-lock-shackle {
    width: 22px;
    height: 22px;
    border: 4px solid var(--w-metal);
    border-bottom: none;
    border-radius: 11px 11px 0 0;
    margin-bottom: -4px;
    transition: 0.4s ease;
    transform-origin: left bottom;
}
.whisper-lock-body {
    width: 50px; height: 50px;
    background: var(--w-cover);
    border-radius: 50%;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15), inset 2px 2px 5px rgba(255,255,255,0.3);
    border: 2px solid #fff;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.8s;
}
.whisper-lock-keyhole {
    width: 24px; height: 24px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.whisper-lock-keyhole::after {
    content: 'W';
    font-family: var(--w-font-serif);
    color: #fff;
    font-size: 14px;
    font-style: italic;
}

.lock-status-text {
    font-family: var(--w-font-serif);
    font-size: 13px;
    letter-spacing: 1px;
    padding: 8px 20px;
    border-radius: 20px;
    transition: 0.3s;
}
.whisper-lock-container.locked .whisper-mini-lock {
    filter: grayscale(100%) opacity(0.8);
}
.whisper-lock-container.locked .lock-status-text {
    background: rgba(0,0,0,0.6);
    color: #fff;
}

.whisper-lock-container.ready {
    animation: w-float 2s ease-in-out infinite;
}
.whisper-lock-container.ready .whisper-mini-lock {
    filter: drop-shadow(0 4px 16px var(--w-cover));
}
.whisper-lock-container.ready .lock-status-text {
    background: var(--w-cover);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: background 0.4s;
}

@keyframes w-float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-6px); }
}

.whisper-lock-container.shake {
    animation: w-shake 0.4s ease;
}
@keyframes w-shake {
    0%, 100% { transform: translateX(0); }
    25%       { transform: translateX(-4px) rotate(-5deg); }
    75%       { transform: translateX(4px) rotate(5deg); }
}

.whisper-box.unlocking .whisper-lock-shackle {
    transform: translateY(-4px) rotate(-30deg);
}
.whisper-box.unlocking .whisper-lock-container {
    transform: scale(1.2);
    opacity: 0;
    transition: all 0.6s ease 0.2s;
}
.whisper-box.unlocking .whisper-chain-l {
    transform: translateY(-40px) rotate(8deg);
    opacity: 0;
}
.whisper-box.unlocking .whisper-chain-r {
    transform: translateY(40px) rotate(-8deg);
    opacity: 0;
}

/* ════ 圆点指示器 ════ */
.whisper-dots {
    display: flex;
    justify-content: center;
    gap: 7px;
    padding: 10px 0 12px;
    flex-shrink: 0;
}
.whisper-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s;
}
.whisper-dot.active {
    background: var(--w-cover);
    transform: scale(1.4);
}

/* ════ 角色抽屉 ════ */
.sheet-mask {
    position: absolute;
    inset: 0;
    background: rgba(40, 35, 33, 0.8);
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
}
.sheet-mask.show {
    opacity: 1;
    pointer-events: auto;
}

.sheet-panel {
    background: #fff;
    border-radius: 32px 32px 0 0;
    height: 65%;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.05);
}
.sheet-mask.show .sheet-panel { transform: translateY(0); }

.sheet-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed rgba(0,0,0,0.05);
    font-family: var(--w-font-serif);
    font-size: 18px;
    font-weight: 600;
    color: var(--w-text-dark);
}
.sheet-close-btn {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--w-text-sub);
    background: none;
    border: none;
    cursor: pointer;
}

#whisper-char-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px 25px 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    max-height: 50vh;
    scrollbar-width: none;
}
#whisper-char-list::-webkit-scrollbar { display: none; }

.gem-avatar {
    display: flex;
    flex-direction: column;
    background: #fff;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}
.gem-avatar:hover,
.gem-avatar.active {
    border-color: var(--w-cover);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    transform: translateY(-3px);
}
.gem-avatar img {
    width: 100%;
    height: 140px;
    border-radius: 4px;
    object-fit: cover;
    margin-bottom: 10px;
}
.sheet-info { text-align: center; }
.sheet-name {
    font-family: var(--w-font-serif);
    font-size: 16px;
    font-weight: 700;
    color: var(--w-text-dark);
}
.sheet-aff {
    font-size: 12px;
    color: var(--w-text-sub);
    margin-top: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.whisper-affinity-track {
    flex: 1;
    height: 4px;
    background: rgba(0,0,0,0.05);
    border-radius: 2px;
    margin-left: 12px;
    overflow: hidden;
}
.whisper-affinity-fill {
    height: 100%;
    background: var(--w-cover);
    border-radius: 2px;
    transition: 0.4s;
}

/* ════ 总览弹窗 ════ */
#whisper-ov-mask {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
}
#whisper-ov-mask.show {
    opacity: 1;
    pointer-events: auto;
}

.whisper-overview-panel {
    background: #fff;
    border-radius: 32px 32px 0 0;
    height: 75%;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.05);
}
#whisper-ov-mask.show .whisper-overview-panel { transform: translateY(0); }

.whisper-overview-head {
    padding: 20px 24px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
}

.toc-tabs { display: flex; gap: 24px; }
.toc-tab {
    font-family: var(--w-font-serif);
    font-size: 18px;
    font-weight: 600;
    color: var(--w-text-sub);
    cursor: pointer;
    transition: 0.3s;
    position: relative;
}
.toc-tab.active { color: var(--w-text-dark); }
.toc-tab.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 3px;
    background: var(--w-cover);
    border-radius: 2px;
    transition: background 0.4s;
}

.ov-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.ov-write-btn {
    background: rgba(0,0,0,0.02);
    border: 1px solid rgba(0,0,0,0.05);
    color: var(--w-cover);
    font-family: var(--w-font-serif);
    font-weight: 600;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 16px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ov-write-btn:active {
    transform: scale(0.95);
    background: var(--w-cover);
    color: #fff;
}
.ov-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--w-text-sub);
    cursor: pointer;
    padding: 0;
    margin-left: 16px;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toc-content-area {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 0;
}
#whisper-ov-list,
.w-items-grid {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: none;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
    transform: translateX(10px);
}
#whisper-ov-list::-webkit-scrollbar,
.w-items-grid::-webkit-scrollbar { display: none; }
#whisper-ov-list.w-tab-active,
.w-items-grid.w-tab-active {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.w-items-grid {
    flex-direction: row;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 12px;
}

.whisper-ov-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #fffdfa;
    border-radius: 16px;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.03);
    transition: 0.2s;
}
.whisper-ov-item:active { transform: scale(0.98); }
.whisper-ov-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--w-cover);
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--w-font-serif);
    font-weight: 600;
    font-size: 14px;
    transition: background 0.4s;
}
.whisper-ov-num.locked { background: #d0c8c9; }
.whisper-ov-info { flex: 1; }
.whisper-ov-title {
    font-family: var(--w-font-serif);
    font-size: 15px;
    color: var(--w-text-dark);
    font-weight: 600;
}
.whisper-ov-sub {
    font-size: 11px;
    color: var(--w-text-sub);
    margin-top: 4px;
}

.w-collect-card {
    width: calc(50% - 6px);
    background: #faf8f5;
    border-radius: 14px;
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(0,0,0,0.03);
    cursor: pointer;
    transition: 0.2s;
}
.w-collect-card:active { transform: scale(0.95); }
.w-collect-icon { font-size: 28px; }
.w-collect-name {
    font-family: var(--w-font-serif);
    font-size: 12px;
    font-weight: 600;
    color: var(--w-text-dark);
}
.w-collect-date { font-size: 10px; color: var(--w-text-sub); }

/* ── 拾光子项页面 ── */
.w-sub-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0 10px;
    font-family: var(--w-font-serif);
    font-size: 15px;
    font-weight: 600;
    color: var(--w-text-dark);
}
.w-sub-back {
    background: none;
    border: none;
    font-size: 26px;
    color: var(--w-text-sub);
    cursor: pointer;
    min-width: 36px;
    line-height: 1;
    padding: 0;
}
.w-sub-item {
    width: calc(50% - 6px);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    display: flex;
    flex-direction: column;
}
.w-sub-item.w-item-polaroid-sub {
    background: #fff;
    padding: 5px 5px 0;
}
.w-sub-item.w-item-ticket-sub {
    background: #fdf6e3;
    border: 1px solid #e0d8c8;
    padding: 8px 6px;
    position: relative;
}
.w-sub-item.w-item-receipt-sub {
    background: #fff;
    padding: 8px 6px;
    font-family: var(--w-font-mono);
}
.w-sub-item.w-item-candy-sub {
    background: linear-gradient(
        135deg,
        rgba(255,182,193,0.15),
        rgba(173,216,230,0.15),
        rgba(255,255,224,0.15)
    );
    border: 1px solid rgba(255,255,255,0.6);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}
.w-sub-item.w-item-cassette-sub {
    background: #f4ead6;
    border: 1px solid #e0d4ba;
    padding: 10px 8px;
    font-family: var(--w-font-hand);
}
.w-sub-item.w-item-letter-sub {
    background: linear-gradient(160deg, #fbf6ee, #f3e9d8);
    border: 1px solid #e3d6c0;
    padding: 10px 8px;
    font-family: var(--w-font-sign);
}

/* ════ 解锁按钮（JS专用） ════ */
.whisper-unlock-btn {
    display: block;
    margin: auto auto 12px;
    padding: 10px 32px;
    background: var(--w-cover);
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 15px;
    font-family: var(--w-font-serif);
    cursor: pointer;
    letter-spacing: 4px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.1);
    transition: 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.whisper-unlock-btn:active {
    opacity: 0.85;
    transform: scale(0.96);
}
.whisper-locked-hint {
    display: block;
    text-align: center;
    margin: auto auto 12px;
    font-size: 12px;
    color: var(--w-text-sub);
    font-family: var(--w-font-sans);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ════ 辅助占位状态 ════ */
.w-empty-state {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fcfaf8;
    padding: 40px;
}
.w-empty-title {
    font-family: Caveat, cursive;
    font-size: 60px;
    color: #dca49a;
    opacity: 0.4;
}
.w-empty-msg {
    font-family: 'Noto Serif SC', serif;
    font-size: 16px;
    color: #5c4d47;
    margin-top: 16px;
}
.w-empty-sub {
    font-size: 13px;
    color: #a89a94;
    margin-top: 8px;
}
.w-empty-btn-back {
    position: absolute;
    top: 50px;
    left: 14px;
    font-size: 26px;
    color: #a89a94;
    background: none;
    border: none;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
}
.w-empty-list {
    text-align: center;
    color: #a89a94;
    padding: 20px;
    font-size: 13px;
}
.w-empty-no-whispers {
    text-align: center;
    color: #a89a94;
    padding: 32px 0;
    font-size: 13px;
}
.w-empty-no-whispers-sub {
    font-size: 11px;
    color: #a89a94;
}
.w-no-whispers {
    color: #c2185b;
    padding: 40px;
}

/* ════ 拾光子项辅助 ════ */
.w-photo-cell {
    height: 70px;
    font-size: 11px;
    color: #a89a94;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px;
    background: linear-gradient(135deg, rgba(220,164,154,0.15), rgba(252,238,227,0.4));
}
.w-photo-date {
    padding: 6px 5px 4px;
    font-size: 10px;
    color: #a89a94;
    text-align: center;
}
.w-barcode-cell {
    margin: 10px auto 6px;
}
.w-ticket-cell {
    font-family: var(--w-font-mono);
    font-size: 11px;
    color: var(--w-text-dark);
    text-align: center;
    padding: 0 8px 8px;
}
.w-ticket-date {
    text-align: center;
    padding-bottom: 6px;
}
.w-receipt-cell {
    font-size: 10px;
    color: #555;
    text-align: center;
    padding: 4px 6px;
}
.w-receipt-date-cell {
    font-size: 9px;
    color: #aaa;
    text-align: center;
    padding-bottom: 4px;
    border-top: 1px dashed #ddd;
    margin-top: 4px;
    padding-top: 4px;
}
.w-candy-cell {
    font-size: 16px;
}
.w-cassette-cell {
    font-size: 15px;
    color: #4a3f39;
    text-align: center;
    line-height: 1.5;
    padding: 4px 6px;
}
.w-cassette-date {
    font-size: 10px;
    color: #9b8e84;
    text-align: center;
    padding-bottom: 4px;
}
.w-letter-cell {
    font-size: 15px;
    color: #4a3f39;
    text-align: center;
    line-height: 1.6;
    padding: 4px 6px;
}
.w-letter-date {
    font-size: 10px;
    color: #b0a48f;
    text-align: center;
    padding-bottom: 4px;
}

/* ════ Toast ════ */
.w-toast {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(14px);
    background: rgba(92,77,71,0.9);
    color: #fff;
    padding: 9px 20px;
    border-radius: 16px;
    font-size: 13px;
    box-shadow: 0 5px 18px rgba(0,0,0,0.12);
    opacity: 0;
    pointer-events: none;
    transition: all 0.32s;
    z-index: 999;
    white-space: nowrap;
    font-family: var(--w-font-sans);
}
.w-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ════ 夜间模式 ════ */
.dark-mode #app-whisper,
[data-theme="dark"] #app-whisper {
    --w-bg: #1e1a18;
    --w-paper: #2a2420;
    --w-cover-dark: #3a4a56;
    --w-text-dark: #e8e0d8;
    --w-text-sub: #7a706c;
    --w-ink-black: #e8e0d8;
    --w-heart-red: #c96a68;
}
.dark-mode #app-whisper .whisper-root::before,
[data-theme="dark"] #app-whisper .whisper-root::before { opacity: 0.15; }
.dark-mode #app-whisper .whisper-root::after,
[data-theme="dark"] #app-whisper .whisper-root::after { opacity: 0.08; }
.dark-mode #app-whisper .whisper-locket-wrapper,
[data-theme="dark"] #app-whisper .whisper-locket-wrapper { background-color: #2e2420; }
.dark-mode #app-whisper .diary-note-paper,
[data-theme="dark"] #app-whisper .diary-note-paper { background: var(--w-paper); }
.dark-mode #app-whisper .sheet-panel,
[data-theme="dark"] #app-whisper .sheet-panel { background: #2a2420; }
.dark-mode #app-whisper .whisper-overview-panel,
[data-theme="dark"] #app-whisper .whisper-overview-panel { background: #252018; }
.dark-mode #app-whisper .gem-avatar,
[data-theme="dark"] #app-whisper .gem-avatar { background: #2e2824; }
.dark-mode #app-whisper .whisper-ov-item,
[data-theme="dark"] #app-whisper .whisper-ov-item { background: #2e2824; }
.dark-mode #app-whisper .w-collect-card,
[data-theme="dark"] #app-whisper .w-collect-card { background: #2e2824; }
.dark-mode #app-whisper .char-selector,
[data-theme="dark"] #app-whisper .char-selector { background: #2e2824; border-color: #3a3430; }
.dark-mode #app-whisper .whisper-back-btn,
.dark-mode #app-whisper .whisper-overview-btn,
[data-theme="dark"] #app-whisper .whisper-back-btn,
[data-theme="dark"] #app-whisper .whisper-overview-btn { background: #2e2824; color: var(--w-text-dark); }
