/* ===== 祝福墙 — 大树挂卡片版 ===== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    overflow-x: hidden;
}

/* ===== 全局背景图 ===== */
body {
    background: url('https://we.fanl.cn/usr/themes/Brave/tree-compressed.jpg') no-repeat center center fixed !important;
    background-size: cover !important;
}

/* ===== 隐藏情侣卡片（保留导航栏和顶部文字栏） ===== */
.lover-container,
.lover-background,
.main-hero-waves-area {
    display: none !important;
}

/* 确保导航栏正常显示 */
.navbar,
nav.navbar {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* 确保顶部文字栏正常显示 */
.main-header-text,
.header-text,
.site-title {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* ===== 花瓣飘落 ===== */
.petals-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1;
}

.petal {
    position: absolute;
    top: -50px;
    font-size: 20px;
    opacity: 0.7;
    animation: petalFall linear infinite;
    will-change: transform;
}

@keyframes petalFall {
    0% { transform: translateY(-50px) translateX(0) rotate(0deg); opacity: 0; }
    10% { opacity: 0.7; }
    90% { opacity: 0.7; }
    100% { transform: translateY(100vh) translateX(100px) rotate(360deg); opacity: 0; }
}

/* ===== 页面容器 ===== */
.tree-page {
    position: relative;
    height: calc(100vh - 94px); overflow: hidden;
    width: 100%;
    background: transparent;
}

/* ===== 大树区域 ===== */
.tree-canvas-wrap {
    position: relative;
    width: 100%;
    height: calc(100vh - 120px);
    overflow: hidden;
}

/* 背景图片层不再需要（body 已有背景） */
.tree-bg-image {
    display: none;
}

/* SVG 装饰层 */
.tree-svg-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* ===== 祝福卡片区域 ===== */
.tree-cards-area {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* ===== 祝福卡片 ===== */
.blessing-tag {
    position: absolute;
    width: 110px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 10px;
    padding: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    pointer-events: auto;
    cursor: pointer;
    transform-origin: top center;
}

.blessing-tag::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 20px;
    background: linear-gradient(to bottom, transparent, rgba(139, 111, 71, 0.8));
}

.blessing-tag::after {
    content: '';
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    background: #8B6F47;
    border-radius: 50%;
}

.blessing-tag:hover {
    transform: scale(1.15) translateY(-5px) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), 0 0 30px rgba(255, 255, 255, 0.4);
    z-index: 10;
}

.blessing-tag .tag-inner { padding: 2px; }

.blessing-tag .tag-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.blessing-tag .avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    background: #f0f0f0;
    flex-shrink: 0;
}

.blessing-tag .tag-head {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
}

.blessing-tag .name {
    font-size: 11px;
    color: #333;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 20px);
    flex-shrink: 1;
    min-width: 0;
}

.blessing-tag .msg {
    font-size: 11px;
    color: #555;
    line-height: 1.4;
    max-height: 70px;
    overflow: hidden;
    word-break: break-all;
}

@keyframes tagAppear {
    0% { opacity: 0; transform: scale(0.5) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes tagSway {
    0%, 100% { transform: rotate(-2deg); }
    50% { transform: rotate(2deg); }
}

/* ===== 空状态 ===== */
.empty-tree-msg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    z-index: 10;
}

.empty-icon { font-size: 60px; display: block; margin-bottom: 15px; }
.empty-tree-msg p { font-size: 18px; }

/* ===== 浮动写祝福按钮 ===== */
.floating-wish-btn {
    position: fixed;
    right: 30px;
    bottom: 30px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: floatBtn 3s ease-in-out infinite;
}

.floating-wish-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

.floating-wish-btn .btn-icon { font-size: 20px; }

@keyframes floatBtn {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ===== 写祝福弹窗 ===== */
.wish-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 200;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wish-modal-overlay.active {
    display: flex;
    opacity: 1;
}

/* 防止弹窗打开时页面滚动 */
body.modal-open {
    overflow: hidden;
}

.wish-modal {
    background: white;
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    margin: 20px;
}

.wish-modal-overlay.active .wish-modal {
    transform: scale(1);
}

.wish-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.wish-modal-header h3 { font-size: 20px; color: #333; }

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover { color: #333; }

/* 关闭按钮（新版） */
.modal-close-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    transition: all .2s;
}
.modal-close-btn:hover { background: #eee; color: #666; }

/* QQ 输入区 */
.qq-input-row {
    display: flex;
    align-items: center;
    gap: 14px;
}
.qq-avatar-preview {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #f0f0f0;
}
.qq-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid #e8e8e8;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    background: #fafafa;
    transition: border-color .2s;
}
.qq-input:focus { border-color: #ff6b6b !important; }

/* 匿名开关 */
.anon-row {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #666;
    padding-left: 2px;
}
.anon-switch-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: #999;
}
.anon-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.anon-switch-track {
    display: inline-block;
    width: 38px;
    height: 20px;
    border-radius: 10px;
    background: #ddd;
    position: relative;
    transition: background 0.3s ease;
    flex-shrink: 0;
}
.anon-switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}
.anon-checkbox:checked + .anon-switch-track {
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
}
.anon-checkbox:checked + .anon-switch-track .anon-switch-thumb {
    transform: translateX(18px);
}
.anon-switch-text {
    color: #999;
}
.anon-name-input {
    width: 100%;
    padding: 9px 14px;
    border: 1.5px solid #e8e8e8;
    border-radius: 10px;
    font-size: 13px;
    outline: none;
    background: #fafafa;
    transition: border-color .2s;
    box-sizing: border-box;
}
.anon-name-input:focus { border-color: #ff6b6b !important; }

/* 祝福内容 */
.wish-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e8e8e8;
    border-radius: 12px;
    font-size: 14px;
    resize: vertical;
    outline: none;
    background: #fafafa;
    line-height: 1.6;
    transition: border-color .2s;
    min-height: 100px;
    box-sizing: border-box;
}
.wish-textarea:focus { border-color: #ff6b6b !important; }

/* 表情 */
.wish-owo { margin-top: -6px; }

/* 提交按钮 */
.wish-submit-btn {
    padding: 11px 20px;
    background: linear-gradient(135deg, #ccc, #bbb);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: not-allowed;
    transition: all .3s ease;
}
.wish-submit-btn:not(:disabled) {
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    cursor: pointer;
}
.wish-submit-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

#wishForm {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ===== 表单样式 ===== */
.wish-inputs { margin-bottom: 15px; }
.wish-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.wish-field { display: flex; flex-direction: column; }

.qq-avatar-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.qq-avatar-wrap .avatar {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.qq-avatar-wrap input { padding-left: 30px; }

.wish-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.wish-input:focus { outline: none; border-color: #ff6b6b; }

.anon-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.anon-row label { font-size: 14px; color: #666; }

.anon-toggle {
    width: 50px;
    height: 26px;
    background: #ccc;
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

.anon-toggle::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: left 0.3s;
}

.anon-toggle.active { background: #4caf50; }
.anon-toggle.active::after { left: 26px; }

.wish-textarea-wrap { margin-bottom: 15px; }

.wish-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.wish-textarea:focus { outline: none; border-color: #ff6b6b; }

.wish-submit-row { text-align: right; }

.wish-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.wish-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.closed-tip { text-align: center; color: #999; padding: 20px; }

/* ===== 底部文字叠在背景图上 ===== */
.p-5.text-center {
    background: transparent !important;
    position: fixed; bottom: 0; left: 0; width: 100%;
    z-index: 5;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

.p-5.text-center h6 {
    color: rgba(255, 255, 255, 0.85) !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5) !important;
}

.p-5.text-center .lover-card-title {
    background: linear-gradient(to right, #ff9999, #ff6b6b, #ff9999) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

.p-5.text-center a { color: rgba(255, 255, 255, 0.7) !important; }

.p-5.text-center .dv {
    color: rgba(255, 255, 255, 0.9) !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5) !important;
}

/* 隐藏底部熊猫图片 */
img.pcbdmap { display: none !important; }
/* 保留右侧浮动按钮组（首页/博客/管理/回顶部） */

/* ===== 响应式 — 手机端分页评论区 ===== */
@media (max-width: 768px) {
    /* 背景改为暖色渐变 */
    body {
        background: linear-gradient(160deg, #ffd1d1 0%, #ffc4b0 30%, #ffd0c0 60%, #ffc8d4 100%) !important;
        background-attachment: fixed !important;
    }

    /* 隐藏树背景图和桌面卡片 */
    .tree-bg { display: none !important; }
    #treeCardsArea { display: none !important; }

    /* 手机端容器 */
    #mobileCardsArea {
        position: fixed !important;
        top: 55px !important;
        left: 0 !important;
        width: 100% !important;
        height: calc(100vh - 55px) !important;
        overflow: hidden !important;
        z-index: 2;
        padding: 10px 12px 0;
        display: flex !important;
        flex-direction: column !important;
    }

    /* 标题 */
    .m-page-title {
        text-align: center;
        color: #8b3a3a !important;
        font-size: 16px;
        font-weight: 600;
        margin-bottom: 10px;
        text-shadow: 0 1px 2px rgba(255,255,255,0.6);
    }

    /* 卡片列表区 */
    .m-cards-list {
        flex: 1 1 0 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        overflow: hidden !important;
        justify-content: flex-start !important;
        padding-bottom: 50px !important;
    }

    /* 单张卡片 — 固定高度 */
    .m-blessing-card {
        background: rgba(255, 255, 255, 0.95) !important;
        border-radius: 10px !important;
        padding: 10px 12px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
        pointer-events: auto !important;
        cursor: pointer !important;
        transition: transform 0.15s ease !important;
        flex-shrink: 0 !important;
        width: 100% !important;
        height: 75px !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
    }
    .m-blessing-card:active {
        transform: scale(0.98) !important;
    }
    .m-blessing-card .m-card-head {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        margin-bottom: 5px !important;
    }
    .m-blessing-card .m-avatar {
        width: 24px !important;
        height: 24px !important;
        border-radius: 50% !important;
        object-fit: cover !important;
        flex-shrink: 0 !important;
    }
    .m-blessing-card .m-name {
        font-size: 13px !important;
        font-weight: 600 !important;
        color: #333 !important;
        flex: 1 !important;
        min-width: 0 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
    .m-blessing-card .m-date {
        font-size: 10px !important;
        color: #bbb !important;
        flex-shrink: 0 !important;
    }
    .m-blessing-card .m-msg {
        font-size: 12px !important;
        color: #555 !important;
        line-height: 1.4 !important;
        word-break: break-word !important;
        overflow: hidden !important;
        flex: 1 !important;
        min-height: 0 !important;
        max-height: 30px !important;
    }
    .m-blessing-card .m-msg img {
        max-height: 16px !important;
        width: auto !important;
        vertical-align: middle !important;
    }

    /* 分页控件 */
    .m-pagination {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 40px !important;
        padding: 8px 0 14px !important;
        flex-shrink: 0 !important;
    }
    /* 用固定宽度的占位符保证布局不变 */
    .m-page-btn {
        height: 28px;
        border: none !important;
        border-radius: 6px !important;
        font-size: 12px !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        padding: 0 10px !important;
        box-sizing: border-box !important;
        line-height: 28px !important;
        text-align: center !important;
        white-space: nowrap !important;
        min-width: 70px !important;
    }
    .m-page-placeholder {
        min-width: 70px !important;
        height: 28px !important;
        display: inline-block !important;
    }
    .m-page-btn.active {
        background: linear-gradient(135deg, #ff6b6b, #ee5a5a) !important;
        color: white !important;
        font-weight: 700 !important;
    }
    .m-page-btn:not(.active):not(:disabled) {
        background: rgba(255,255,255,0.9) !important;
        color: #666 !important;
    }
    .m-page-btn:disabled {
        opacity: 0.3 !important;
        cursor: not-allowed !important;
        background: rgba(255,255,255,0.5) !important;
        color: #999 !important;
    }
    .m-page-info {
        color: #8b3a3a !important;
        font-size: 12px !important;
        line-height: 28px !important;
        flex-shrink: 0 !important;
        text-shadow: 0 1px 2px rgba(255,255,255,0.6) !important;
    }

    /* 写祝福按钮适配 */
    #openWishModal {
        padding: 8px 18px !important;
        font-size: 13px !important;
    }
    /* 写祝福按钮位置上移，不遮挡卡片 */
    .blessing-tree-page > div[style*="bottom:120px"] {
        bottom: 50px !important;
    }

    /* 弹窗适配 — 手机端紧凑表单 */
    .wish-modal-overlay {
        padding: 0 !important;
    }
    .wish-modal-overlay.active {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }
    .wish-modal {
        width: calc(100vw - 24px) !important;
        max-width: none !important;
        max-height: 88vh !important;
        padding: 16px !important;
        margin: 0 !important;
        border-radius: 14px !important;
        box-sizing: border-box !important;
        overflow-y: auto !important;
    }
    .wish-modal-header {
        margin-bottom: 12px !important;
        padding: 0 2px !important;
    }
    .wish-modal-header h3 {
        font-size: 15px !important;
    }
    .modal-close-btn {
        width: 24px !important;
        height: 24px !important;
        font-size: 14px !important;
        flex-shrink: 0 !important;
    }
    #wishForm {
        gap: 9px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 0 6px !important;
    }
    .qq-input-row {
        gap: 16px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        align-items: center !important;
    }
    .qq-avatar-preview {
        width: 32px !important;
        height: 32px !important;
        border-width: 1.5px !important;
        flex-shrink: 0 !important;
    }
    .qq-input {
        padding: 7px 12px !important;
        font-size: 12px !important;
        border-radius: 8px !important;
        border-width: 1px !important;
        flex: 1 !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }
    .anon-row {
        display: flex !important;
        justify-content: center !important;
        padding: 4px 0 !important;
    }
    .anon-switch-label {
        font-size: 11px !important;
        gap: 7px !important;
    }
    .anon-switch-track {
        width: 34px !important;
        height: 18px !important;
        border-radius: 9px !important;
    }
    .anon-switch-thumb {
        width: 14px !important;
        height: 14px !important;
        top: 2px !important;
        left: 2px !important;
    }
    .anon-checkbox:checked + .anon-switch-track .anon-switch-thumb {
        transform: translateX(16px) !important;
    }
    .anon-switch-text {
        font-size: 11px !important;
    }
    .anon-name-input {
        padding: 7px 12px !important;
        font-size: 12px !important;
        border-radius: 8px !important;
        border-width: 1px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .wish-textarea {
        padding: 9px 12px !important;
        font-size: 12px !important;
        border-radius: 8px !important;
        border-width: 1px !important;
        min-height: 65px !important;
        line-height: 1.5 !important;
        width: 100% !important;
        box-sizing: border-box !important;
        resize: none !important;
    }
    .wish-owo {
        transform: scale(0.88);
        transform-origin: left center;
        margin: 0 !important;
    }
    .wish-submit-btn {
        padding: 9px 16px !important;
        font-size: 13px !important;
        border-radius: 10px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        margin-top: 2px !important;
    }
    /* 写祝福按钮位置上移，不遮挡卡片 */
    .blessing-tree-page > div[style*="bottom:120px"] {
        bottom: 50px !important;
    }

    .petal { font-size: 12px !important; }
}

/* 桌面端隐藏手机容器 */
#mobileCardsArea { display: none; }

/* ===== 点击爱心特效 z-index 提升（确保可见） ===== */
/* 爱心元素会被追加到 body，用最高 z-index 确保不被祝福树的 fixed 层遮挡 */
.heart {
    z-index: 2147483647 !important;
    position: fixed !important;
}

/* ===== 防止页面出现滚动条 ===== */
html, body {
    overflow: hidden !important;
    height: 100% !important;
}

/* 确保 body 内的内容容器不会撑出滚动条 */
body > .container-fluid.position-relative {
    height: 100vh !important;
    overflow: hidden !important;
}

/* pjax 容器内的祝福树页面占满全屏 */
.blessing-tree-page {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100vh !important;
    z-index: 1 !important;
}

/* 导航栏固定在顶部 */
body > .container-fluid.position-relative > nav.navbar {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 50;
}

/* 隐藏底部 footer 区域在祝福树页面中的显示 */
body > .p-5.text-center {
    display: none !important;
}
