/* 夏日留言板 v3 - 响应式、长按菜单、触摸优化、滚动条、安全区域 */
/* ==================== ĺĺşĺźäźĺ?==================== */
@media (max-width: 375px) {
    .logo-text {
        font-size: 16px;
    }
    
    .online-label {
        display: none;
    }
    
    /* 窄屏收紧头部徽章，保证主题与在线状态仍在同一行 */
    .header-stats {
        gap: 6px;
    }
    
    .theme-badge {
        padding: 6px 9px;
    }
    
    .theme-badge span:not(.theme-badge-icon) {
        display: none;
    }
    
    .message-card {
        padding: 14px;
    }
    
    .author-avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .message-content {
        font-size: 16px;
    }
    
    /* 窄屏进一步压缩嵌套缩进，给内容留出可读宽度 */
    .message-replies {
        padding-left: 14px;
    }
    
    .message-replies::before {
        left: 3px;
    }
    
    .message-replies::after {
        left: -1px;
    }
    
    .message-card-reply::before {
        left: -8px;
        width: 7px;
    }
    
    .message-card-reply {
        padding: 10px 11px;
    }
    
    .images-grid.count-2 img { aspect-ratio: 1; }
    .images-grid.count-3 img:nth-child(1) { aspect-ratio: 16 / 9; }
    .images-grid.count-3 img:nth-child(2),
    .images-grid.count-3 img:nth-child(3) { aspect-ratio: 1; }
    .images-grid.count-4 img { aspect-ratio: 1; }
    .images-grid.count-5 img:nth-child(1),
    .images-grid.count-5 img:nth-child(2) { aspect-ratio: 16 / 10; }
    .images-grid.count-5 img:nth-child(3),
    .images-grid.count-5 img:nth-child(4),
    .images-grid.count-5 img:nth-child(5) { aspect-ratio: 1; }
    .images-grid.count-6 img { aspect-ratio: 1; }
}

@media (min-width: 768px) {
    .main {
        padding-bottom: 120px;
    }
    
    .header {
        padding: 12px 0 0;
    }
    
    /* 第一行与心情栏在大屏上统一用 24px 内距 */
    .header-row-1 {
        padding: 0 24px;
    }
    
    .mood-board-inner {
        padding: 6px 24px 8px;
    }
    
    .logo-text {
        font-size: 20px;
    }
    
    .message-card {
        padding: 20px;
        border-radius: var(--radius-xl);
    }
    
    .author-avatar {
        width: 44px;
        height: 44px;
        font-size: 17px;
    }
    
    .sheet {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%) translateY(100%);
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    }
    
    .sheet.active {
        transform: translateX(-50%) translateY(0);
    }
    
    .fab {
        width: 60px;
        height: 60px;
        right: calc(50% - 300px + 24px);
    }
    
    .fab svg {
        width: 28px;
        height: 28px;
    }
}

/* ==================== éżćčĺ ==================== */
.longpress-menu {
    position: fixed;
    display: none;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    overflow: hidden;
    animation: menuSlideIn 0.15s ease;
}

@keyframes menuSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.longpress-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}

.longpress-menu-item:active {
    background: rgba(239, 68, 68, 0.08);
}

.longpress-menu-item:first-child {
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.menu-item-icon {
    font-size: 18px;
    line-height: 1;
}

.menu-item-text {
    font-size: 15px;
    color: #EF4444;
    font-weight: 600;
}

/* ==================== č§Ść¸äźĺ ==================== */
@media (hover: none) {
    .btn-like:hover,
    .btn-load-more:hover,
    .message-card:hover {
        transform: none;
    }
}

/* ==================== ćťĺ¨ćĄçžĺ?==================== */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.08);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.12);
}

/* ==================== éä¸­ćĺ­ ==================== */
::selection {
    background: rgba(77, 208, 225, 0.35);
    color: var(--text-primary);
}

/* ==================== ĺŽĺ¨ĺşĺ ==================== */
/* 这里原有一段 @supports 把 .toast 的 top 覆盖成 calc(70px + env(safe-area-inset-top))。
   它比 05-overlay.css 晚加载且特异性相同，在所有支持 env() 的浏览器上胜出，
   使 toast 落到约 117-129px —— 比头部底部还高 30-40px，直接浮在心情栏上方。
   头部自身 padding-top 已含 env(safe-area-inset-top)，安全区已计入 --header-h 的实测值，
   在 toast 上再叠一次是重复计算。已删除，统一走 05-overlay.css 的 var(--header-h)。（第 9 条） */


/* ==================== 动画降级（第 25 条）==================== */
/* 多处无限循环动画（FAB 呼吸、3 个背景光斑、在线点脉冲、叶子摇摆、引导页图标浮动）
   叠上 backdrop-filter 后是持续的 GPU 合成开销：滚动掉帧、机身发热。
   原先只有 03-message / 09-quick-reply / compose 三处局部做了 reduced-motion，
   FAB、背景光斑、在线点脉冲等均未受约束。这里统一兜底。 */
@media (prefers-reduced-motion: reduce) {
    /* 装饰性无限动画：全部停掉 */
    .bg-blob,
    .petal,
    .fab,
    .logo-icon,
    .online-dot,
    .password-icon,
    .onboarding-icon,
    .identity-icon {
        animation: none !important;
    }

    /* 全局：把所有过渡与动画压到极短，保留可访问性上必要的状态变化反馈，
       但不再有持续合成。不用 animation:none 全局禁掉，避免骨架屏、spinner
       这类「靠动画传递状态」的元素变成静止后让人误以为卡死。 */
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    /* 例外：loading spinner 仍需转动，否则用户看不出「正在加载」 */
    .sheet-spinner,
    .compose-spinner,
    .refresh-icon.spinning {
        animation-duration: 0.75s !important;
        animation-iteration-count: infinite !important;
    }
}

/* ==================== 滚动期间降级合成（第 25 条进阶）==================== */
/* 滚动时给 body 加 .is-scrolling（由 03-init.js 的 scroll 监听切换），
   临时停掉背景光斑与 FAB 呼吸。这两组动画在滚动时根本看不清，
   但会和固定头部的 backdrop-filter 一起抢 GPU。滚动结束后自动恢复。 */
body.is-scrolling .bg-blob,
body.is-scrolling .petal,
body.is-scrolling .fab {
    animation-play-state: paused;
}
