/* ============================================================
   宝宝成长记录照片墙 · 样式表
   融合：莫兰迪暖色 + 气泡背景 + 黑胶唱片 + 双视图 + 上传
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
    --pink-light: #fce8e3;
    --pink-mid: #f5d5cc;
    --pink-warm: #e8c4b8;
    --pink-accent: #d4a08a;
    --pink-deep: #b87d6a;
    --blue-pale: #e8f0f5;
    --blue-soft: #c9dce8;

    --color-bg: #faf5ef;
    --color-text: #4a3f3a;
    --color-text-light: #8a7e78;
    --color-text-lighter: #b5aba4;
    --color-white: #fffcf9;

    --glass-bg: rgba(255, 252, 249, 0.78);
    --glass-border: rgba(255, 255, 255, 0.55);
    --glass-blur: 20px;

    --shadow-sm: 0 2px 12px rgba(74, 63, 58, 0.05);
    --shadow-card: 0 4px 24px rgba(74, 63, 58, 0.08), 0 2px 8px rgba(74, 63, 58, 0.04);
    --shadow-lg: 0 12px 48px rgba(74, 63, 58, 0.12);
    --shadow-hover: 0 16px 48px rgba(200, 160, 140, 0.18);

    --radius-card: 24px;
    --radius-btn: 14px;
    --radius-chip: 22px;

    --font-display: "ZCOOL XiaoWei", serif;
    --font-body: "Noto Serif SC", serif;

    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --dur-normal: 0.35s;

    --nav-height: 72px;
    --content-padding: 24px;
}

/* ---- Reset ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    color: var(--color-text);
    cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'><circle cx='14' cy='14' r='13' fill='rgba(232,196,184,0.8)' stroke='white' stroke-width='2'/><text x='14' y='20' text-anchor='middle' font-size='14'>⭐</text></svg>") 14 14, auto;
}

a, button, .card, .scroll-slide-card, .month-chip, .nav-btn, .card-delete, .upload-dropzone, .dropzone-content, .preview-remove {
    cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><circle cx='16' cy='16' r='14' fill='rgba(232,196,184,0.9)' stroke='white' stroke-width='2.5'/><text x='16' y='23' text-anchor='middle' font-size='16'>👆</text></svg>") 16 16, pointer;
}

input, textarea { cursor: auto; }

/* ============================================================
   顶部阅读进度条（CSS-only, 零 JS）
   用 animation-timeline: scroll(root block) 监听页面滚动比例
   不支持时进度条保持 0 宽度（隐藏），不破坏布局
   ============================================================ */
.reading-progress {
    position: fixed; top: 0; left: 0; right: 0;
    height: 3px; z-index: 9999;
    background: linear-gradient(90deg, var(--pink-mid), var(--pink-accent) 50%, var(--pink-deep));
    transform-origin: left;
    transform: scaleX(0);
    pointer-events: none;
    box-shadow: 0 1px 4px rgba(212, 160, 138, 0.35);
    transition: opacity 0.3s ease;
}
@supports (animation-timeline: scroll()) {
    .reading-progress {
        animation: progress-grow linear both;
        animation-timeline: scroll(root block);
    }
    @keyframes progress-grow {
        from { transform: scaleX(0); }
        to   { transform: scaleX(1); }
    }
}

/* ============================================================
   气泡背景
   ============================================================ */
/* 气泡粒子已升级为 Canvas 渲染（见 script.js initCanvasBubbles），无需 DOM/CSS */

/* 背景渐变 */
.bg-gradient {
    position: fixed; inset: 0; z-index: 1; pointer-events: none;
    background:
        radial-gradient(ellipse 75% 55% at 25% 15%, rgba(245, 213, 204, 0.28) 0%, transparent 55%),
        radial-gradient(ellipse 55% 45% at 80% 80%, rgba(201, 220, 232, 0.25) 0%, transparent 55%),
        radial-gradient(ellipse 65% 35% at 50% 45%, rgba(232, 196, 184, 0.10) 0%, transparent 65%);
    background-size: 400% 400%;
    animation: bgBreathe 14s ease-in-out infinite;
}
/* 支持 color-mix 时让背景跟随季节色温（旧浏览器回退到上方硬编码粉色调） */
@supports (background: color-mix(in srgb, red, transparent)) {
    .bg-gradient {
        background:
            radial-gradient(ellipse 75% 55% at 25% 15%, color-mix(in srgb, var(--pink-mid) 30%, transparent) 0%, transparent 55%),
            radial-gradient(ellipse 55% 45% at 80% 80%, color-mix(in srgb, var(--blue-soft) 28%, transparent) 0%, transparent 55%),
            radial-gradient(ellipse 65% 35% at 50% 45%, color-mix(in srgb, var(--pink-warm) 14%, transparent) 0%, transparent 65%);
    }
}

@keyframes bgBreathe {
    0%, 100% { background-position: 0% 50%; }
    25%      { background-position: 100% 0%; }
    50%      { background-position: 100% 100%; }
    75%      { background-position: 0% 100%; }
}

/* ============================================================
   顶部导航栏
   ============================================================ */
.navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    padding: 10px var(--content-padding);
}

.nav-inner {
    max-width: 1200px; margin: 0 auto;
    display: flex; align-items: center; gap: 12px;
    padding: 10px 22px; border-radius: 22px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(150%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(150%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
}

.nav-brand {
    display: flex; align-items: center; gap: 8px;
    font-family: var(--font-display); font-size: 1.15rem;
    color: var(--color-text); white-space: nowrap; cursor: pointer;
}

.nav-brand i {
    font-size: 1.35rem; color: var(--pink-accent);
    animation: iconBounce 2.2s ease-in-out infinite;
}

@keyframes iconBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50%      { transform: translateY(-5px) scale(1.12); }
}

.nav-actions {
    display: flex; align-items: center; gap: 10px; margin-left: auto; flex-shrink: 0;
}

.nav-btn {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    border: 1.5px solid rgba(200, 180, 170, 0.2);
    border-radius: var(--radius-btn);
    background: rgba(255, 255, 255, 0.55);
    color: var(--color-text-light);
    transition: all var(--dur-normal) var(--ease-bounce);
    position: relative;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    color: var(--pink-deep);
    transform: scale(1.08);
    border-color: var(--pink-warm);
}

.nav-btn i { font-size: 1.15rem; transition: transform 0.3s; }

/* 上传按钮特殊样式 */
.upload-btn { border-color: var(--pink-warm); }
.upload-btn i { color: var(--pink-accent); }
.upload-btn:hover { background: var(--pink-light); }

/* 真实黑胶唱片（同心圆纹路 + 中央 label + 中心圆孔） */
.bgm-btn { overflow: visible; }

/* 外层：定位 + 缩放（响应 hover 微互动），不参与旋转 */
.vinyl-disc {
    position: absolute; top: 50%; left: 50%;
    width: 26px; height: 26px;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: transform var(--dur-normal) var(--ease-bounce),
                opacity var(--dur-normal) var(--ease-bounce);
    pointer-events: none;
}
.bgm-btn.playing .vinyl-disc {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
.bgm-btn:hover .vinyl-disc {
    transform: translate(-50%, -50%) scale(1.08);
}

/* 内层：唱片纹路 + label + 旋转（在自身中心转，不受外层 transform 干扰） */
.vinyl-label {
    position: absolute; inset: 0; border-radius: 50%;
    background:
        /* 中心 label（粉橘，半径 32%） */
        radial-gradient(circle at center, var(--pink-accent) 0%, var(--pink-accent) 32%, transparent 32%),
        /* 黑胶片：深灰底 + 细密同心圆纹路 */
        repeating-radial-gradient(circle at center, #1a1a1a 0px, #2e2e2e 1px, #1a1a1a 2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
}
/* 中心圆孔 */
.vinyl-label::before {
    content: ""; position: absolute; top: 50%; left: 50%;
    width: 4px; height: 4px; border-radius: 50%;
    background: var(--color-bg);
    transform: translate(-50%, -50%);
    z-index: 1;
}
/* 旋转标记：让旋转"看得见"（细白条纹） */
.vinyl-label::after {
    content: ""; position: absolute; top: 50%; left: 50%;
    width: 18%; height: 1.5px;
    background: rgba(255, 255, 255, 0.28);
    transform-origin: 0 50%;
    transform: translate(0, -50%);
}

/* 播放时旋转；hover 时暂停，方便细看唱片 */
.bgm-btn.playing .vinyl-label {
    animation: vinylSpin 1.6s linear infinite;
}
.bgm-btn.playing:hover .vinyl-label {
    animation-play-state: paused;
}
.bgm-btn.playing i { color: var(--pink-accent); }

/* 播放/暂停状态角标：播放时显示暂停符号，一眼可辨 */
.bgm-state {
    position: absolute; right: -3px; bottom: -3px;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--color-card);
    border: 1.5px solid var(--pink-accent);
    color: var(--pink-accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.74rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    z-index: 2;
    transition: background 0.25s var(--ease-smooth), color 0.25s var(--ease-smooth);
}
.bgm-btn.playing .bgm-state {
    background: var(--pink-accent);
    color: #fff;
}
.bgm-state i { font-size: 0.74rem; }

@keyframes vinylSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* 视图切换 */
.view-toggle { width: auto; padding: 0 15px; gap: 6px; border-radius: 22px; font-family: var(--font-body); font-size: 0.82rem; font-weight: 500; }

/* 月份快捷跳转 */
.nav-months { display: flex; gap: 7px; min-width: 0; flex: 1 1 auto; cursor: grab; }
.nav-months.is-dragging { cursor: grabbing; user-select: none; scroll-behavior: auto; }
.month-chip {
    padding: 7px 15px; border: 1.5px solid rgba(200, 180, 170, 0.25);
    border-radius: var(--radius-chip); background: rgba(255, 255, 255, 0.4);
    color: var(--color-text-light); font-family: var(--font-body);
    font-size: 0.76rem; transition: all var(--dur-normal) var(--ease-bounce); white-space: nowrap;
}
.month-chip:hover {
    background: var(--pink-light); color: var(--pink-deep);
    border-color: var(--pink-warm); transform: translateY(-1px);
}

/* ============================================================
   主内容
   ============================================================ */
.main-content {
    position: relative; z-index: 2;
    padding-top: calc(var(--nav-height) + 36px); padding-bottom: 20px;
    max-width: 1200px; margin: 0 auto;
    padding-left: var(--content-padding); padding-right: var(--content-padding);
}

/* 视图容器：双视图切换 */
.view-timeline, .view-coverflow { display: none; }
.view-timeline.active, .view-coverflow.active { display: block; }

/* View Transitions API 自定义动画 (Chrome 111+) */
::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.4s;
    animation-timing-function: var(--ease-smooth);
}
::view-transition-old(root) { animation-name: vt-fade-out; }
::view-transition-new(root) { animation-name: vt-fade-in; }

@keyframes vt-fade-out { to { opacity: 0; transform: scale(0.98); } }
@keyframes vt-fade-in  { from { opacity: 0; transform: scale(1.02); } }

.timeline-header, .coverflow-header { text-align: center; margin-bottom: 40px; }

.timeline-title, .coverflow-title {
    font-family: var(--font-display); font-size: 2rem;
    color: var(--color-text); font-weight: 400; margin-bottom: 6px; letter-spacing: 0.04em;
}

.title-icon { display: inline-block; animation: iconBounce 2s ease-in-out infinite; }
.title-icon:last-child { animation-delay: 1s; }

.timeline-subtitle, .coverflow-subtitle {
    font-size: 0.92rem; color: var(--color-text-light); letter-spacing: 0.06em;
}

/* 自动播放按钮 */
.autoplay-btn {
    display: inline-flex; align-items: center; gap: 6px;
    margin-left: 16px; padding: 6px 16px;
    border: 1.5px solid var(--pink-warm); border-radius: 20px;
    background: rgba(255,255,255,0.5); backdrop-filter: blur(6px);
    color: var(--pink-accent); font-size: 0.82rem; cursor: pointer;
    transition: all 0.25s var(--ease-bounce); vertical-align: middle;
}
.autoplay-btn:hover { background: var(--pink-accent); color: #fff; border-color: var(--pink-accent); }
.autoplay-btn.playing { background: var(--pink-accent); color: #fff; }
.autoplay-btn.playing i { animation: pulse-dot 1.5s ease-in-out infinite; }
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:0.3} }
.autoplay-btn i { font-size: 1.1rem; }

/* ============================================================
   回忆统计 Hero 卡（数字滚动 + SVG 成长圆环）
   ============================================================ */
.stats-hero {
    display: flex; align-items: center; gap: 30px;
    margin: -8px 0 38px; padding: 24px 30px;
    border-radius: var(--radius-card);
    background: var(--glass-bg);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-card);
}

.stats-age { display: flex; align-items: center; gap: 18px; flex-shrink: 0; }

/* 头像圆环：外层按钮承载点击，SVG 圆环绝对铺满，头像居中盖在上层 */
.age-ring-wrap {
    position: relative; width: 96px; height: 96px; flex-shrink: 0;
    border: none; background: none; padding: 0; cursor: pointer;
    border-radius: 50%;
}
.age-ring-wrap .age-ring {
    position: absolute; inset: 0; width: 100%; height: 100%;
    transform: rotate(-90deg);
}
.age-ring-wrap .ring-bg {
    fill: none; stroke: rgba(212, 160, 138, 0.18); stroke-width: 9;
}
.age-ring-wrap .ring-fg {
    fill: none; stroke: var(--pink-accent); stroke-width: 9;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.2s var(--ease-smooth);
}
.avatar-holder {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
}
.avatar-img,
.avatar-ph {
    width: 78px; height: 78px; border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 3px 10px rgba(120, 80, 60, 0.18);
}
.avatar-img { object-fit: cover; background: var(--pink-mid); }
.avatar-ph {
    display: flex; align-items: center; justify-content: center;
    font-size: 2.2rem; color: #fff;
    background: linear-gradient(135deg, var(--pink-mid), var(--pink-accent));
}
.avatar-hint {
    position: absolute; right: 0; bottom: 0;
    width: 27px; height: 27px; border-radius: 50%;
    background: var(--pink-deep); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: transform 0.25s var(--ease-smooth), background 0.25s var(--ease-smooth);
}
.age-ring-wrap:hover .avatar-hint,
.age-ring-wrap:focus-visible .avatar-hint { transform: scale(1.12); background: var(--pink-accent); }
.age-ring-wrap.uploading .avatar-hint { animation: avatarPulse 0.8s infinite alternate; }
@keyframes avatarPulse { from { transform: scale(1); } to { transform: scale(1.15); } }

.age-ring-text .age-big {
    font-family: var(--font-display); font-size: 1.55rem;
    color: var(--color-text); display: block; white-space: nowrap;
}
.age-ring-text .age-sub {
    font-size: 0.78rem; color: var(--color-text-light); white-space: nowrap;
}

.stats-grid {
    flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.stat-item { text-align: center; }
.stat-item i { font-size: 1.5rem; color: var(--pink-accent); }
.stat-num {
    display: block; font-family: var(--font-display);
    font-size: 1.7rem; color: var(--color-text); line-height: 1.2;
}
.stat-item span { font-size: 0.75rem; color: var(--color-text-light); }

/* 一年内"回忆今天"推送 chip */
.memory-chip {
    display: flex; align-items: center; gap: 10px;
    margin: -6px 0 26px; padding: 12px 18px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 229, 180, 0.5), rgba(255, 209, 168, 0.45));
    border: 1px solid rgba(212, 160, 138, 0.35);
    color: #7a5238; font-size: 0.88rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s var(--ease-bounce), box-shadow 0.25s var(--ease-smooth);
}
.memory-chip:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.memory-chip i { color: var(--pink-deep); font-size: 1.1rem; flex-shrink: 0; }
.memory-chip .memory-close { margin-left: auto; font-size: 1rem; opacity: 0.6; }
.memory-chip .memory-close:hover { opacity: 1; }

/* ============================================================
   BGM 迷你播放器面板（黑胶圆形频谱 + 曲目名 + 切歌/播放控制）
   ============================================================ */
.player-panel {
    position: fixed;
    right: var(--content-padding);
    bottom: calc(var(--safe-bottom) + 24px);
    z-index: 950;
    display: flex; align-items: center; gap: 16px;
    padding: 12px 16px;
    border-radius: 22px;
    background: rgba(30, 22, 20, 0.92);
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.32);
    color: #fff;
    transform: translateY(16px);
    opacity: 0;
    transition: transform 0.3s var(--ease-bounce), opacity 0.3s var(--ease-smooth);
}
.player-panel.show { transform: translateY(0); opacity: 1; }
.player-panel[hidden] { display: none; }

.player-info { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* 黑胶唱片 + 环绕的圆形频谱画布 */
.player-vinyl-wrap { position: relative; width: 48px; height: 48px; flex-shrink: 0; }
.player-vinyl-wrap canvas {
    position: absolute; inset: 0; width: 100%; height: 100%;
}
.player-vinyl {
    position: absolute; top: 50%; left: 50%;
    width: 30px; height: 30px;
    margin: -15px 0 0 -15px;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, var(--pink-accent) 0%, var(--pink-accent) 30%, transparent 30%),
        repeating-radial-gradient(circle at center, #1a1a1a 0px, #2e2e2e 1px, #1a1a1a 2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.player-vinyl::after {
    content: ""; position: absolute; top: 50%; left: 50%;
    width: 5px; height: 5px; border-radius: 50%;
    background: #1a1a1a;
    transform: translate(-50%, -50%);
}
.player-vinyl.spinning { animation: vinylSpin 1.6s linear infinite; }

.player-text {
    display: flex; flex-direction: column; min-width: 0; max-width: 150px;
}
.player-track {
    font-size: 0.85rem; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player-count { font-size: 0.7rem; opacity: 0.7; margin-top: 1px; }

.player-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.player-btn {
    width: 38px; height: 38px; border-radius: 50%;
    border: none; background: rgba(255, 255, 255, 0.12);
    color: #fff; font-size: 1.1rem;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.25s var(--ease-bounce);
}
.player-btn:hover { background: var(--pink-accent); color: #fff; transform: scale(1.08); }
.player-btn:active { transform: scale(0.92); }
.player-toggle {
    width: 44px; height: 44px;
    background: var(--pink-accent); color: #fff; font-size: 1.25rem;
}
.player-toggle:hover { background: var(--pink-deep); }
.player-close { opacity: 0.6; }
.player-close:hover { background: rgba(255, 100, 100, 0.35); color: #fff; opacity: 1; }
.player-btn[hidden] { display: none; }

/* 音量调节浮层提示（屏幕中央，键盘 ↑/↓ 调节时短暂弹出） */
.volume-toast {
    position: fixed; top: 50%; left: 50%;
    z-index: 9000;
    display: flex; align-items: center; gap: 12px;
    padding: 14px 26px;
    background: rgba(30, 22, 20, 0.92);
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    border-radius: 18px;
    color: #fff; font-size: 1.05rem; font-weight: 500;
    opacity: 0; pointer-events: none;
    transform: translate(-50%, -50%) scale(0.85);
    transition: opacity 0.2s ease, transform 0.25s var(--ease-bounce);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
    letter-spacing: 0.04em;
}
.volume-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
.volume-toast i {
    font-size: 1.4rem;
    color: var(--pink-accent);
}

/* 切歌浮层提示（屏幕中央，键盘 ←/→ 切换曲目时短暂弹出，与 .volume-toast 视觉一致） */
.track-toast {
    position: fixed; top: 50%; left: 50%;
    z-index: 9000;
    display: flex; align-items: center; gap: 12px;
    padding: 14px 26px;
    background: rgba(30, 22, 20, 0.92);
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    border-radius: 18px;
    color: #fff; font-size: 1.05rem; font-weight: 500;
    opacity: 0; pointer-events: none;
    transform: translate(-50%, -50%) scale(0.85);
    transition: opacity 0.2s ease, transform 0.25s var(--ease-bounce);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
    letter-spacing: 0.04em;
    max-width: 80vw;
}
.track-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
.track-toast i {
    font-size: 1.4rem;
    color: var(--pink-accent);
}
.track-toast span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   瀑布流 Masonry
   ============================================================ */
.masonry-container { column-count: 3; column-gap: 22px; }

.month-group-label {
    column-span: all; font-family: var(--font-display);
    font-size: 1.3rem; color: var(--color-text);
    margin: 38px 0 20px; padding: 6px 0 6px 14px;
    border-left: 3px solid var(--pink-warm);
}

/* ============================================================
   卡片
   ============================================================ */
.card {
    break-inside: avoid; margin-bottom: 22px;
    border-radius: var(--radius-card);
    background: var(--glass-bg);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow-card); overflow: hidden;
    transition: transform var(--dur-normal) var(--ease-bounce), box-shadow var(--dur-normal) var(--ease-smooth);
    position: relative;
    /* 注意：不使用 content-visibility，避免与 .card-reveal 的 scroll-driven 入场动画冲突
       （分页渲染已把 DOM 控制在每批 24 条，无需离线跳过优化） */
}

.card:hover { transform: translateY(-6px) scale(1.02); box-shadow: var(--shadow-hover); }

/* 删除按钮 */
.card-delete {
    position: absolute; top: 12px; right: 12px; z-index: 10;
    width: 32px; height: 32px; border-radius: 50%;
    border: none; background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    color: var(--color-text-light); font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transform: scale(0.8);
    transition: all var(--dur-normal) var(--ease-bounce);
}

.card:hover .card-delete { opacity: 1; transform: scale(1); }

.card-delete:hover {
    background: rgba(255, 100, 100, 0.15); color: #e05555;
}

/* 媒体区域 */
.card-media {
    position: relative; width: 100%; overflow: hidden;
    background: linear-gradient(135deg, var(--pink-light), var(--blue-pale));
}

.card-media img, .card-media video { display: block; width: 100%; height: auto; object-fit: cover; }
.card-media video { position: relative; z-index: 2; } /* Ensure poster sits above skeleton */
/* .card-media video { display: none; } Removed to allow poster thumbnail to show */

.card-media .play-icon {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none; z-index: 2;
}

.card-media .play-icon i {
    font-size: 3.2rem; color: rgba(255, 255, 255, 0.9);
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.35));
    transition: transform var(--dur-normal) var(--ease-bounce);
}

.card:hover .play-icon i { transform: scale(1.1); }

.card-badge {
    position: absolute; top: 12px; left: 12px;
    padding: 5px 12px; border-radius: 12px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    color: #fff; font-size: 0.7rem;
    display: flex; align-items: center; gap: 4px;
    pointer-events: none; z-index: 3;
}

/* 用户上传标记 */
.card-badge.user-upload {
    left: auto; right: 12px;
    background: rgba(212, 160, 138, 0.75);
}

/* 卡片信息面板 */
.card-info {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 22px 18px 18px;
    background: linear-gradient(to top, rgba(255,252,249,0.96) 0%, rgba(255,252,249,0.82) 60%, transparent 100%);
    transform: translateY(35%);
    transition: transform var(--dur-normal) var(--ease-bounce);
    z-index: 4;
}

.card:hover .card-info { transform: translateY(0); }

.card-info .card-date {
    font-size: 0.72rem; font-weight: 600; color: var(--pink-deep);
    margin-bottom: 3px; display: inline-block;
    background: rgba(232, 196, 184, 0.2);
    padding: 2px 10px; border-radius: 10px;
}

.card-info .card-title { font-family: var(--font-display); font-size: 1.15rem; color: var(--color-text); margin-bottom: 2px; }
.card-info .card-age { font-size: 0.75rem; color: var(--color-text-light); font-weight: 500; }

.card-info .card-desc {
    font-size: 0.8rem; color: var(--color-text-lighter); line-height: 1.55;
    margin-top: 6px; opacity: 0; transform: translateY(6px);
    transition: all var(--dur-normal) var(--ease-smooth) 0.06s;
}

.card:hover .card-info .card-desc { opacity: 1; transform: translateY(0); }

/* ============================================================
   里程碑卡片（✨ 情感化标记）
   ============================================================ */
.card.is-milestone {
    box-shadow: 0 8px 32px rgba(212, 160, 138, 0.25);
}
.card.is-milestone::before {
    content: "✨ 里程碑";
    position: absolute; top: 12px; left: 12px; z-index: 6;
    padding: 4px 12px; border-radius: 12px;
    background: linear-gradient(135deg, #ffe5b4, #ffd1a8);
    color: #8b5a3c; font-size: 0.72rem; font-weight: 600;
    animation: milestoneShine 2s ease-in-out infinite;
    pointer-events: none;
}
/* 视频角标与里程碑标签共存时下移，避免重叠 */
.card.is-milestone .card-badge { top: 44px; }

@keyframes milestoneShine {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 215, 130, 0.5); }
    50%      { box-shadow: 0 0 0 6px rgba(255, 215, 130, 0); }
}

/* 画廊卡片的小星星标记 */
.scroll-slide-card.is-milestone { box-shadow: 0 10px 40px rgba(212, 160, 138, 0.3); }
.scroll-slide-card.is-milestone::before {
    content: "✨";
    position: absolute; top: 14px; left: 14px; z-index: 6;
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #ffe5b4, #ffd1a8);
    font-size: 1rem;
    animation: milestoneShine 2s ease-in-out infinite;
    pointer-events: none;
}

/* ============================================================
   卡片瀑布入场动画（CSS-only Scroll-Driven，零 JS 开销）
   仅浏览器支持 animation-timeline: view() 时启用，否则原样显示
   ============================================================ */
.card-reveal { will-change: opacity, transform; }

@supports (animation-timeline: view()) {
    .masonry-container .card .card-reveal {
        animation: reveal-up linear both;
        animation-timeline: view();
        animation-range: entry 10% entry 40%;
    }
    /* 3 列错开，制造"流淌"感 */
    .masonry-container .card:nth-child(3n+1) .card-reveal { animation-range: entry 5%  entry 35%; }
    .masonry-container .card:nth-child(3n+2) .card-reveal { animation-range: entry 10% entry 40%; }
    .masonry-container .card:nth-child(3n+3) .card-reveal { animation-range: entry 15% entry 45%; }
}
@keyframes reveal-up {
    from { opacity: 0; transform: translateY(70px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* "回忆今天"高亮闪烁 */
.card.memory-flash { animation: memoryFlash 0.6s ease 3; }
@keyframes memoryFlash {
    0%, 100% { box-shadow: 0 0 0 0 rgba(212, 160, 138, 0); }
    50%      { box-shadow: 0 0 0 8px rgba(212, 160, 138, 0.45); }
}

/* ============================================================
   原生 CSS 滚动画廊（Scroll Snap + Scroll-Driven Animations）
   ============================================================ */

/* 原生横向滚动容器 */
.native-scroll-gallery {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    max-width: 100%;
    padding: 40px calc(50vw - 160px) 80px; /* 两侧留白，首尾卡片能居中吸附 */
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.native-scroll-gallery::-webkit-scrollbar { display: none; }

/* 单张卡片 */
.scroll-slide-card {
    flex: 0 0 320px;
    height: 440px;
    scroll-snap-align: center;
    border-radius: var(--radius-card);
    background: var(--glass-bg);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-lg);
    transition: box-shadow 0.3s ease;
}

.scroll-slide-card img,
.scroll-slide-card video {
    display: block; width: 100%; height: 100%; object-fit: cover;
    position: relative; z-index: 2;
}
/* .scroll-slide-card video { display: none; } Removed to allow poster thumbnail to show */

/* 当卡片处于视口中央（被吸附），点亮阴影 */
.scroll-slide-card:target,
.scroll-slide-card.active-snap {
    box-shadow: 0 14px 56px rgba(200, 160, 140, 0.35);
}

/* 指示点（替代原 Swiper 分页器） */
.gallery-dots {
    display: flex; justify-content: center; gap: 10px;
    margin-top: -50px; padding-bottom: 40px; position: relative; z-index: 5;
}
.gallery-dot {
    width: 9px; height: 9px; border-radius: 6px;
    background: var(--pink-warm); opacity: 0.35;
    cursor: pointer; transition: all 0.3s var(--ease-bounce);
}
.gallery-dot.active { opacity: 1; background: var(--pink-accent); width: 26px; }

.coverflow-info {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 26px 20px 18px;
    background: linear-gradient(to top, rgba(74,63,58,0.7) 0%, transparent 100%);
    color: #fff; pointer-events: none;
}
.coverflow-info .cf-date { font-size: 0.7rem; opacity: 0.85; margin-bottom: 3px; }
.coverflow-info .cf-title { font-family: var(--font-display); font-size: 1.15rem; }
.coverflow-info .cf-age { font-size: 0.73rem; opacity: 0.8; }

.coverflow-play {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none; z-index: 2;
}
.coverflow-play i {
    font-size: 3.5rem; color: rgba(255,255,255,0.85);
    filter: drop-shadow(0 2px 10px rgba(0,0,0,0.4));
}

/* ─── Scroll-Driven 3D 动画 (Chrome 115+) ─── */
@supports (animation-timeline: view()) {
    .scroll-slide-card {
        animation: coverflow-3d linear both;
        animation-timeline: view(inline);
    }

    @keyframes coverflow-3d {
        0%   {
            transform: perspective(1000px) rotateY(-30deg) scale(0.82) translateZ(-60px);
            opacity: 0.5;
        }
        30%  {
            transform: perspective(1000px) rotateY(-5deg) scale(0.95) translateZ(-10px);
            opacity: 0.8;
        }
        50%  {
            transform: perspective(1000px) rotateY(0deg) scale(1) translateZ(0px);
            opacity: 1;
            z-index: 10;
            box-shadow: 0 14px 56px rgba(200, 160, 140, 0.4);
        }
        70%  {
            transform: perspective(1000px) rotateY(5deg) scale(0.95) translateZ(-10px);
            opacity: 0.8;
        }
        100% {
            transform: perspective(1000px) rotateY(30deg) scale(0.82) translateZ(-60px);
            opacity: 0.5;
        }
    }
}

/* Safari 降级：不支持 3D 滚动驱动时，纯原生横滚 + 按压反馈 */
@supports not (animation-timeline: view()) {
    .scroll-slide-card {
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }
    .scroll-slide-card:active {
        transform: scale(0.96);
    }
}

/* ============================================================
   上传模态框
   ============================================================ */
.modal-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(30, 22, 20, 0.45);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity var(--dur-normal) var(--ease-smooth);
    padding: 20px;
}

.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-card {
    background: var(--color-white);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-lg);
    width: 100%; max-width: 480px;
    max-height: 90vh; overflow-y: auto;
    transform: translateY(20px) scale(0.96);
    transition: transform var(--dur-normal) var(--ease-bounce);
}

.modal-overlay.active .modal-card { transform: translateY(0) scale(1); }

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px 16px; border-bottom: 1px solid rgba(0,0,0,0.05);
}

.modal-header h3 {
    font-family: var(--font-display); font-size: 1.15rem;
    color: var(--color-text); display: flex; align-items: center; gap: 8px;
}
.modal-header h3 i { color: var(--pink-accent); }

.modal-close {
    width: 34px; height: 34px; border-radius: 50%;
    border: none; background: rgba(0,0,0,0.04);
    color: var(--color-text-light); font-size: 1.1rem;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--dur-normal);
}

.modal-close:hover { background: rgba(0,0,0,0.08); color: var(--color-text); }

.modal-body { padding: 20px 24px; }

/* 拖拽上传区 */
.upload-dropzone {
    border: 2px dashed rgba(200, 180, 170, 0.4);
    border-radius: 18px; padding: 32px 20px;
    text-align: center; transition: all var(--dur-normal);
    position: relative; overflow: hidden;
    background: rgba(250, 245, 239, 0.4);
    cursor: pointer; min-height: 140px;
    display: flex; align-items: center; justify-content: center;
}

.upload-dropzone.drag-over {
    border-color: var(--pink-accent);
    background: rgba(232, 196, 184, 0.12);
}

.dropzone-content i {
    font-size: 2.5rem; color: var(--pink-accent);
    display: block; margin-bottom: 10px;
}

.dropzone-content p {
    font-size: 0.9rem; color: var(--color-text); margin-bottom: 4px;
}

.dropzone-content span {
    font-size: 0.75rem; color: var(--color-text-lighter);
}

/* 预览区 */
.dropzone-preview { position: relative; width: 100%; }
.dropzone-preview img, .dropzone-preview video {
    width: 100%; max-height: 200px; object-fit: contain;
    border-radius: 12px;
}
.preview-remove {
    position: absolute; top: 8px; right: 8px;
    width: 28px; height: 28px; border-radius: 50%;
    border: none; background: rgba(0,0,0,0.5); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; transition: all var(--dur-normal);
}
.preview-remove:hover { background: rgba(220, 60, 60, 0.8); }

/* 表单 */
.modal-form { margin-top: 20px; display: flex; flex-direction: column; gap: 14px; }

.form-row { display: flex; flex-direction: column; gap: 5px; }

.form-row label {
    font-size: 0.8rem; font-weight: 600; color: var(--color-text-light);
}

.form-row input, .form-row textarea {
    padding: 10px 14px; border: 1.5px solid rgba(200, 180, 170, 0.3);
    border-radius: 12px; font-family: var(--font-body); font-size: 0.88rem;
    color: var(--color-text); background: rgba(250, 245, 239, 0.5);
    transition: all var(--dur-normal); outline: none;
    resize: vertical;
}

.form-row input:focus, .form-row textarea:focus {
    border-color: var(--pink-accent);
    background: rgba(255, 252, 249, 0.9);
    box-shadow: 0 0 0 3px rgba(212, 160, 138, 0.1);
}

.modal-footer {
    display: flex; gap: 10px; justify-content: flex-end;
    padding: 16px 24px 20px; border-top: 1px solid rgba(0,0,0,0.04);
}

.btn-cancel, .btn-save {
    padding: 10px 22px; border-radius: 14px;
    font-family: var(--font-body); font-size: 0.85rem; font-weight: 500;
    transition: all var(--dur-normal) var(--ease-bounce);
    display: flex; align-items: center; gap: 6px;
}

.btn-cancel {
    border: 1.5px solid rgba(200, 180, 170, 0.25);
    background: transparent; color: var(--color-text-light);
}
.btn-cancel:hover { background: rgba(0,0,0,0.03); }

.btn-save {
    border: none;
    background: linear-gradient(135deg, var(--pink-accent), var(--pink-deep));
    color: #fff; box-shadow: 0 4px 16px rgba(212, 160, 138, 0.3);
}
.btn-save:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(212, 160, 138, 0.4); }
.btn-save:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ============================================================
   页脚
   ============================================================ */
.footer {
    position: relative; z-index: 5; text-align: center;
    padding: 16px 20px 32px; font-size: 0.85rem;
    color: var(--color-text-light); letter-spacing: 0.05em;
}

/* ============================================================
   Fancybox
   ============================================================ */
.fancybox__container {
    --fancybox-bg: rgba(30, 22, 20, 0.94);
    --fancybox-accent-color: #d4a08a;
}

/* ============================================================
   响应式
   ============================================================ */

@media (max-width: 900px) {
    .masonry-container { column-count: 2; column-gap: 16px; }
    .card { margin-bottom: 16px; }
    .nav-months { display: none; }
    .scroll-slide-card { width: 260px; height: 350px; }
    .modal-card { max-width: 420px; }
}

@media (max-width: 600px) {
    .masonry-container { column-count: 1; }
    .nav-inner { padding: 8px 14px; border-radius: 16px; }
    .nav-brand span { display: none; }
    .timeline-title, .coverflow-title { font-size: 1.45rem; }
    .view-toggle .view-label { display: none; }
    .view-toggle { width: 40px; padding: 0; justify-content: center; }
    .scroll-slide-card { width: 230px; height: 300px; }
    .native-scroll-gallery { padding: 30px calc(50vw - 115px) 60px; }
    .modal-card { max-width: 100%; border-radius: 20px 20px 0 0; align-self: flex-end; }
    .upload-dropzone { padding: 24px 16px; min-height: 110px; }
    .modal-body { padding: 16px 18px; }
    .modal-header { padding: 16px 18px 12px; }
    .modal-footer { padding: 12px 18px 16px; }
}

@media (min-width: 1200px) {
    .native-scroll-gallery { max-width: 1100px; margin: 0 auto; }
}

/* ============================================================
   性能与适老化优化（v2 重构）
   ============================================================ */

/* ---- 1. 硬件加速：背景呼吸改为 transform（避免全屏重绘） ---- */
.bg-gradient {
    inset: -4%;
    will-change: transform;
    animation: bgBreathe 16s ease-in-out infinite;
}
@keyframes bgBreathe {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50%      { transform: translate3d(0, 0, 0) scale(1.035); }
}

/* ---- 2. 视图切换（View Transitions API 接管动画） ---- */
.main-content { display: grid; position: relative; }

.view-timeline, .view-coverflow {
    display: none;
    grid-area: 1 / 1;
    min-width: 0;
}

/* ---- 3. 骨架屏（毛玻璃 + 柔和扫光，动画纯 transform） ---- */
.card-media { min-height: 240px; }
.card-media.has-ratio { min-height: 0; }   /* 已知宽高比时用 aspect-ratio 精确占位 */

.media-skeleton {
    position: absolute; inset: 0; z-index: 1;
    overflow: hidden; pointer-events: none;
    background: linear-gradient(160deg, var(--pink-light), var(--blue-pale));
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.media-skeleton::before {
    content: ""; position: absolute; top: 0; bottom: 0; left: -80%; width: 60%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.65), transparent);
    animation: skeletonSweep 1.6s ease-in-out infinite;
    will-change: transform;
}
@keyframes skeletonSweep {
    0%   { transform: translateX(0); }
    100% { transform: translateX(420%); }
}
/* 媒体加载完成 → 骨架淡出 */
.card-media.loaded .media-skeleton,
.cf-media-wrap.loaded .media-skeleton {
    opacity: 0; animation: none;
    transition: opacity 0.5s var(--ease-smooth);
}

/* ---- 4. 图片淡入 + 视频悬停显隐（避免 display 生硬切换） ---- */
.card-media img {
    opacity: 0;
    transition: opacity 0.55s var(--ease-smooth);
}
.card-media img.loaded { opacity: 1; }
/* Video always block to show poster. video-active will only hide the play-icon */
.card-media .play-icon { transition: opacity var(--dur-normal) var(--ease-smooth); }
.card-media.video-active .play-icon { opacity: 0; }

/* ---- 5. 适老化：48px 点击热区 + 按压反馈 ---- */
.nav-btn { width: 48px; height: 48px; }
.view-toggle { width: auto; min-height: 48px; padding: 0 18px; }
.month-chip { min-height: 48px; padding: 8px 18px; font-size: 0.8rem; }

.card-delete {
    width: 48px; height: 48px; font-size: 1.2rem;
    opacity: 0.85; transform: scale(1);
}
.card:hover .card-delete { opacity: 1; }

.modal-close { width: 48px; height: 48px; font-size: 1.25rem; }
.preview-remove { width: 48px; height: 48px; font-size: 1.1rem; }
.btn-cancel, .btn-save { min-height: 48px; }

/* 按压反馈：纯 transform 缩放，不触发重排 */
.nav-btn:active, .view-toggle:active, .month-chip:active,
.modal-close:active, .preview-remove:active, .card-delete:active,
.btn-cancel:active, .btn-save:not(:disabled):active, .load-more-btn:active {
    transform: scale(0.92);
}

/* 键盘焦点环（适老化/无障碍） */
:where(button, .card, .month-chip):focus-visible {
    outline: 3px solid var(--pink-accent);
    outline-offset: 3px;
}

/* ---- 6. 画廊：懒加载淡入 + 硬件加速层 ---- */
.cf-media-wrap { position: relative; width: 100%; height: 100%; overflow: hidden; }
.cf-media-wrap img {
    width: 100%; height: 100%; object-fit: cover;
    opacity: 0; transition: opacity 0.5s var(--ease-smooth);
}
.cf-media-wrap img.loaded { opacity: 1; }
/* Video always block to show poster */
.cf-media-wrap .coverflow-play { transition: opacity var(--dur-normal) var(--ease-smooth); }
.cf-media-wrap.video-active .coverflow-play { opacity: 0; }

/* 卡片硬件加速 */

.empty-tip {
    display: flex; align-items: center; justify-content: center;
    height: 100%; color: var(--color-text-light); font-size: 1.05rem;
}

/* ---- 7. 加载更多 / 状态区 ---- */
.timeline-footer { text-align: center; margin: 8px 0 34px; }
#timelineSentinel { height: 1px; }
.load-more-btn {
    min-height: 48px; padding: 0 28px; border-radius: 24px;
    border: 1.5px solid var(--pink-warm);
    background: rgba(255, 255, 255, 0.65);
    color: var(--pink-deep); font-family: var(--font-body); font-size: 0.92rem;
    cursor: pointer; box-shadow: var(--shadow-sm);
    transition: transform 0.25s var(--ease-bounce), box-shadow 0.25s var(--ease-smooth);
}
.load-more-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.timeline-done {
    font-size: 0.88rem; color: var(--color-text-light);
    letter-spacing: 0.05em; padding: 6px 0;
}

/* 保存中按钮的旋转小圆点 */
.btn-spinner {
    display: inline-block; width: 15px; height: 15px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    animation: btnSpin 0.7s linear infinite;
}
@keyframes btnSpin { to { transform: rotate(360deg); } }

/* ---- 8. Fancybox：手势 + 大按钮 ---- */
.fancybox__toolbar button { min-width: 48px; min-height: 48px; }
.fancybox__caption { font-size: 1.05rem; }

/* ---- 9. 触屏设备：信息常显、删除按钮常显（长辈友好） ---- */
@media (hover: none) {
    .card-info { transform: none; }
    .card-info .card-desc { opacity: 1; transform: none; }
    .card-delete { opacity: 0.9; }
}

/* ---- 10. 减弱动画偏好（晕动/老设备友好） ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   数据化重构补充样式 (Loading & Code Generator)
   ============================================================ */

/* 全局 Loading 屏 */
.global-loader {
    position: fixed; inset: 0; z-index: 9999;
    background: var(--color-bg);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: opacity 0.6s var(--ease-smooth), visibility 0.6s;
}
.global-loader.hidden { opacity: 0; visibility: hidden; }
.loader-spinner {
    width: 50px; height: 50px; margin-bottom: 20px;
    border: 4px solid var(--pink-warm); border-top-color: var(--pink-deep);
    border-radius: 50%; animation: spin 1s linear infinite;
}
.global-loader p { font-family: var(--font-display); font-size: 1.2rem; color: var(--color-text); }
@keyframes spin { to { transform: rotate(360deg); } }

/* 代码生成结果提示 */
.json-tip { font-size: 0.9rem; color: var(--color-text-light); line-height: 1.6; margin-bottom: 15px; }
.json-tip code { background: rgba(0,0,0,0.05); padding: 2px 6px; border-radius: 4px; color: var(--pink-deep); }
.code-box {
    position: relative; background: #282c34; border-radius: 12px;
    padding: 16px; overflow: hidden;
}
.code-box pre {
    margin: 0; overflow-x: auto; font-family: Consolas, monospace;
    font-size: 0.85rem; color: #abb2bf; line-height: 1.5;
}
.copy-btn {
    position: absolute; top: 10px; right: 10px;
    background: rgba(255,255,255,0.15); border: none; color: #fff;
    padding: 6px 12px; border-radius: 6px; font-size: 0.8rem;
    display: flex; align-items: center; gap: 4px; transition: all 0.2s;
}
.copy-btn:hover { background: var(--pink-accent); }
.copy-btn.copied { background: #4caf50; }

/* ============================================================
   移动端生产级适配（Mobile-First + Safe Area）
   ============================================================ */

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

*, *::before, *::after {
    -webkit-tap-highlight-color: transparent;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 全面屏安全区变量 */
:root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
}

/* 手机端惯性滚动 */
html, body, .masonry-container, .code-box pre, .modal-card {
    -webkit-overflow-scrolling: touch;
}

/* 顶部导航避让刘海/灵动岛 */
.navbar {
    top: var(--safe-top);
    padding-left: calc(var(--content-padding) + var(--safe-left));
    padding-right: calc(var(--content-padding) + var(--safe-right));
}

.nav-inner {
    padding-left: calc(22px + var(--safe-left));
    padding-right: calc(22px + var(--safe-right));
}

/* 主内容与页脚避开 iOS 底部小白条 */
.main-content {
    padding-bottom: calc(20px + var(--safe-bottom));
}
.footer {
    padding-bottom: calc(28px + var(--safe-bottom));
}

/* 底部弹出的模态框同样避开 Home Indicator */
.modal-overlay {
    padding-bottom: calc(20px + var(--safe-bottom));
}

/* 统一触控反馈：消除灰色点击闪烁，阻止双击整页放大 */
button, a, .card, .scroll-slide-card, .month-chip, .nav-btn, .upload-dropzone, .copy-btn, .modal-close {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* 适老化 44px 触控热区兜底 */
.copy-btn,
.btn-cancel,
.btn-save,
.month-chip,
.preview-remove,
.modal-close {
    min-height: 44px;
}
.copy-btn {
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* 手机端瀑布流、导航栏与画廊 */
@media (max-width: 600px) {
    :root {
        --nav-height: 108px;
        --content-padding: 14px;
    }

    /* iOS Safari：输入框字号 <16px 时聚焦会自动放大页面，统一提到 16px 规避 */
    .form-row input,
    .form-row textarea {
        font-size: 16px;
    }

    .nav-inner {
        min-height: 56px;
        gap: 8px;
        padding: 6px 12px;
        padding-left: calc(12px + var(--safe-left));
        padding-right: calc(12px + var(--safe-right));
    }

    .masonry-container {
        column-count: 1;
        column-gap: 0;
        padding: 0 4px;
    }

    .view-coverflow {
        min-width: 0;
    }

    .native-scroll-gallery {
        width: 100%;
        max-width: 100%;
    }

    .card {
        width: 100%;
        margin-bottom: 16px;
    }

    .card-media img,
    .card-media video {
        width: 100%;
        height: auto;
    }

    .card-info .card-date,
    .card-info .card-title,
    .card-info .card-age,
    .card-info .card-desc,
    .coverflow-info .cf-date,
    .coverflow-info .cf-title,
    .coverflow-info .cf-age {
        font-size: 14px;
        line-height: 1.45;
    }

    .card-info .card-title,
    .coverflow-info .cf-title {
        font-size: 17px;
    }

    .json-tip {
        font-size: 14px;
    }

    .code-box pre {
        font-size: 12px;
    }

    .scroll-slide-card {
        width: min(78vw, 300px);
        height: min(100vw, 400px);
    }

    .native-scroll-gallery {
        padding: 18px calc(50vw - min(39vw, 150px)) 62px;
    }

    .view-toggle {
        width: 48px;
        padding: 0;
        justify-content: center;
    }

    /* 上传弹窗用 dvh 参考真实可见高度，避免键盘弹出后底部按钮被顶出屏幕 */
    .modal-card {
        max-height: 85dvh;
    }

    .timeline-header,
    .coverflow-header {
        margin-bottom: 24px;
    }
}

/* 触屏设备：信息常显，视频悬停预览不参与触控 */
@media (hover: none) and (pointer: coarse) {
    .card-info {
        transform: none;
    }
    .card-info .card-desc {
        opacity: 1;
        transform: none;
    }
    /* 移除移动端强制隐藏 video 逻辑，以确保显示封面(poster) */
    .card-media .play-icon,
    .coverflow-play {
        display: flex;
        opacity: 1;
        align-items: center;
        justify-content: center;
    }
}

/* 月份快捷导航：按年龄动态生成，支持跨年记录 + 手机横滑 */
.nav-months {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.nav-months::-webkit-scrollbar { display: none; }

.nav-brand {
    flex-shrink: 0;
}

@media (max-width: 900px) {
    .nav-months { display: flex; }
}

@media (max-width: 600px) {
    .nav-inner { flex-wrap: wrap; }
    .nav-months {
        order: 3;
        flex: 1 1 100%;
        width: 100%;
        max-width: 100%;
        justify-content: flex-start;
        padding: 2px 0 4px;
    }
    .month-chip {
        min-height: 40px;
        padding: 6px 12px;
    }
}

/* 专业图标替换 emoji 后的视觉统一 */
.title-icon i {
    display: inline-block;
    font-size: 1.45rem;
    color: var(--pink-accent);
}

.load-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.footer i {
    color: var(--pink-accent);
    margin-right: 4px;
}

.form-row label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-row label i {
    color: var(--pink-accent);
    font-size: 1rem;
}

.empty-tip i {
    display: block;
    font-size: 2rem;
    color: var(--pink-accent);
    margin-bottom: 10px;
}

.timeline-done i {
    color: var(--pink-accent);
    margin-right: 4px;
}

/* ============================================================
   新增功能响应式（统计卡 / 频谱面板）
   ============================================================ */
@media (max-width: 700px) {
    .stats-hero {
        flex-direction: column; align-items: center;
        gap: 18px; padding: 20px;
    }
    .stats-grid { width: 100%; grid-template-columns: repeat(2, 1fr); }
    /* 小屏下圆环略缩、文字允许换行，避免"橙多多已经陪伴我们 N 天"溢出 */
    .age-ring-wrap { width: 84px; height: 84px; }
    .avatar-img,
    .avatar-ph { width: 68px; height: 68px; }
    .avatar-ph { font-size: 1.9rem; }
    .avatar-hint { width: 24px; height: 24px; font-size: 0.8rem; }
    .age-ring-text .age-big,
    .age-ring-text .age-sub {
        white-space: normal; text-align: left; max-width: 55vw;
    }
    .player-panel {
        left: var(--content-padding);
        right: var(--content-padding);
        justify-content: space-between;
        bottom: calc(var(--safe-bottom) + 14px);
    }
    .player-text { max-width: none; flex: 1; }
}
