:root {
    --primary-red: #ff2442;
    --bg-white: #ffffff;
    --bg-gray: #f9f9f9;
    --text-black: #333333;
    --text-gray: #666666;
    --text-light-gray: #999999;
    --border-color: #f0f0f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

body {
    background-color: #f2f2f2; /* 恢复外部背景为淡灰色，或者根据需要设置 */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* 模拟手机容器 */
.mobile-container {
    width: 100%;
    max-width: 450px; /* 电脑端模拟手机宽度 */
    height: 100vh;
    height: 100dvh;
    background: url('static/background.jpg') no-repeat center center;
    background-size: cover;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
}

/* 真实移动端适配 */
@media (max-width: 480px) {
    body {
        background: none;
        background-color: #fff;
    }
    .mobile-container {
        max-width: none;
        height: 100vh;
        height: 100dvh;
        box-shadow: none;
        background: url('static/background.jpg') no-repeat center center fixed;
        background-size: cover;
    }
}

/* 状态栏 */
.status-bar {
    height: 44px;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
}

.status-icons {
    display: flex;
    gap: 4px;
}

.status-icons .material-symbols-rounded {
    font-size: 18px;
}

/* 顶部导航 */
.mobile-header {
    height: 44px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header-tabs {
    flex: 1;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.tab-item {
    font-size: 16px;
    color: var(--text-light-gray);
    position: relative;
    padding: 8px 0;
    cursor: pointer;
}

.tab-item.active {
    color: var(--text-black);
    font-weight: bold;
}

.tab-item.active::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background-color: var(--primary-red);
    border-radius: 2px;
}

.header-left, .header-right {
    width: 40px;
    display: flex;
    align-items: center;
}

.header-right {
    justify-content: flex-end;
    gap: 12px;
}

#musicBtn {
    cursor: pointer;
    font-size: 22px;
    color: var(--text-gray);
    transition: color 0.3s;
}

#musicBtn.playing {
    color: var(--primary-red);
    animation: rotate 3s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 主内容区 */
.mobile-main {
    flex: 1;
    overflow-y: auto;
    background-color: transparent; /* 改为透明以透出背景图 */
    padding: 10px;
}

.mobile-main::-webkit-scrollbar {
    display: none;
}

/* 瀑布流 */
/* 关注页作者列表 */
.following-authors {
    display: flex;
    gap: 20px;
    padding: 15px 16px;
    background: rgba(255, 255, 255, 0.5); /* 更透明一些 */
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    overflow-x: auto;
    border-bottom: 1px solid var(--border-color);
}

.following-authors::-webkit-scrollbar {
    display: none;
}

.author-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.author-item .avatar-wrapper {
    position: relative;
    width: 56px;
    height: 56px;
    padding: 0;
    border: none;
    border-radius: 50%;
}

.author-item img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.author-item .live-tag {
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-red);
    color: #fff;
    font-size: 8px;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 4px;
    border: 1px solid #fff;
}

.author-item .author-name {
    font-size: 11px;
    color: var(--text-gray);
    max-width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.waterfall {
    padding: 10px;
    column-count: 2;
    column-gap: 10px;
}

.note-card {
    break-inside: avoid;
    background-color: rgba(255, 255, 255, 0.85); /* 卡片半透明 */
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* 首页笔记主图 */
.note-card .note-image {
    width: 100%;
    display: block;
}

.note-info {
    padding: 8px;
}

.note-title {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 6px;
    color: var(--text-black);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.author {
    display: flex;
    align-items: center;
    gap: 4px;
}

.author-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    display: block; /* 确保是块级显示 */
}

.author-name {
    font-size: 11px;
    color: var(--text-gray);
}

.like-count {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    color: var(--text-gray);
}

.like-count .material-symbols-rounded {
    font-size: 14px;
}

/* 底部导航 */
.mobile-footer {
    height: 56px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom);
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.footer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-light-gray);
    cursor: pointer;
}

.footer-item.active {
    color: var(--text-black);
}

.footer-item .material-symbols-rounded {
    font-size: 24px;
}

.footer-text {
    font-size: 10px;
    margin-top: 2px;
}

.publish-btn .plus-icon {
    width: 40px;
    height: 30px;
    background-color: var(--primary-red);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.publish-btn .material-symbols-rounded {
    font-size: 24px;
}

/* --- 详情页样式 --- */
.detail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-white);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transform: translateX(100%); /* 默认在右侧隐藏 */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.detail-overlay.active {
    transform: translateX(0);
}

.detail-header {
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-white);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

#closeDetail {
    font-size: 20px;
    cursor: pointer;
    color: var(--text-black);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-direction: row; /* 强制横向排列 */
}

.header-user .author-avatar {
    width: 32px;
    height: 32px;
}

.header-user .author-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-black);
    white-space: nowrap; /* 防止名字换行 */
}

.header-right {
    display: flex;
    align-items: center;
}

.header-actions-img {
    height: 40px; /* 从 32px 放大到 40px */
    width: auto;
    object-fit: contain;
    cursor: pointer;
    margin-right: -4px; /* 微调右边距，使其更贴合边缘 */
}

.detail-content {
    flex: 1;
    overflow-y: auto;
    background-color: var(--bg-white);
}

.detail-image-container {
    width: 100%;
    background-color: var(--bg-white); /* 背景改为白色消除黑边 */
    position: relative;
    overflow: hidden;
}

.detail-image-wrapper {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
}

.detail-image-wrapper:active {
    cursor: grabbing;
}

/* 隐藏滚动条 */
.detail-image-wrapper::-webkit-scrollbar {
    display: none;
}

.detail-image {
    width: 100%;
    flex: 0 0 100%;
    scroll-snap-align: start;
    display: block;
    object-fit: cover; /* 填充整个宽度 */
}

.swiper-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    cursor: pointer;
    display: none; /* 默认隐藏，仅在电脑端或悬浮时显示 */
    align-items: center;
    justify-content: center;
    z-index: 15;
    transition: background 0.3s;
}

.detail-image-container:hover .swiper-btn {
    display: flex;
}

.swiper-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

.swiper-prev { left: 10px; }
.swiper-next { right: 10px; }

.swiper-pagination {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
}

.swiper-pagination .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
}

.swiper-pagination .dot.active {
    background: #fff;
    transform: scale(1.2);
}

.detail-text-container {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border-color);
}

.detail-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-black);
}

.detail-desc {
    font-size: 15px;
    line-height: 1.8;
    color: #444;
    white-space: pre-line; /* 保留换行 */
}

.detail-date {
    font-size: 12px;
    color: var(--text-light-gray);
    margin-top: 16px;
}

.detail-comments {
    padding: 20px 16px;
}

.comment-count {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-black);
    margin-bottom: 20px;
}

.no-comment-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    color: var(--text-light-gray);
    gap: 8px;
}

.no-comment-placeholder .material-symbols-rounded {
    font-size: 48px;
    opacity: 0.5;
}

.no-comment-placeholder p {
    font-size: 14px;
}

.comment-item {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.comment-item .author-avatar {
    width: 36px;
    height: 36px;
}

.comment-images {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    margin-bottom: 6px;
}

/* --- 图片放大预览 --- */
.image-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
}

.image-viewer.active {
    display: flex;
}

.image-viewer img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

/* 在手机上，让图片尽可能填满 */
@media (max-width: 480px) {
    .image-viewer img {
        width: 100%;
    }
}

.comment-img {
    width: 85px;
    height: 85px;
    border-radius: 6px;
    object-fit: cover;
    cursor: zoom-in;
    transition: opacity 0.2s;
}

.comment-img:hover {
    opacity: 0.8;
}

/* --- 生日祝福弹窗 --- */
.birthday-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: rgba(255, 255, 255, 0.95);
    padding: 24px 32px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(255, 36, 66, 0.2);
    z-index: 2000;
    text-align: center;
    display: none;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 36, 66, 0.1);
    min-width: 240px;
}

.birthday-toast.active {
    display: block;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.toast-content .material-symbols-rounded {
    font-size: 48px;
    color: var(--primary-red);
    margin-bottom: 12px;
    display: block;
}

.toast-content p {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-black);
    margin-bottom: 8px;
}

.toast-content .toast-sub {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-gray);
    margin-bottom: 0;
}

.red-heart {
    color: #ff2442;
    display: inline-block;
    animation: heartBeat 1.2s infinite;
    margin-left: 2px;
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    14% { transform: scale(1.3); }
    28% { transform: scale(1); }
    42% { transform: scale(1.3); }
    70% { transform: scale(1); }
}

/* --- 烟花画布样式 --- */
#fireworksCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000; /* 置于最顶层 */
    pointer-events: auto; /* 允许点击交互 */
    background: rgba(0, 0, 0, 0.8); /* 烟花背景色 */
    display: none;
    cursor: crosshair;
}

.close-fireworks {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: none; /* 默认隐藏 */
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 3001; /* 位于画布之上 */
    cursor: pointer;
    transition: background 0.3s;
}

.close-fireworks:hover {
    background: rgba(255, 255, 255, 0.4);
}

.close-fireworks .material-symbols-rounded {
    font-size: 24px;
}

.fireworks-guidance {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    text-align: center;
    z-index: 3001;
    pointer-events: none;
    display: none;
    animation: fadeInOut 5s forwards;
}

.fireworks-guidance p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.fireworks-guidance .guidance-sub {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 4px;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, 20px); }
    10% { opacity: 1; transform: translate(-50%, 0); }
    80% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -20px); }
}

/* 详情页中的跳转链接样式 */
.firework-link {
    color: #5b92e1;
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
    display: inline-block;
    margin-top: 8px;
    padding: 4px 8px;
    background: rgba(91, 146, 225, 0.1);
    border-radius: 4px;
    transition: all 0.2s;
}

.firework-link:hover {
    background: rgba(91, 146, 225, 0.2);
    transform: translateY(-1px);
}

.comment-date {
    font-size: 12px;
    color: var(--text-light-gray);
    margin-top: 6px;
}

.comment-info {
    flex: 1;
}

.comment-user {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-gray);
    margin-bottom: 4px;
}

.comment-text {
    font-size: 15px;
    color: var(--text-black);
    line-height: 1.5;
}

.detail-footer {
    height: 56px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
    background: var(--bg-white);
}

.comment-input-mock {
    flex: 1;
    height: 36px;
    background-color: var(--bg-gray);
    border-radius: 999px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    font-size: 14px;
    color: var(--text-light-gray);
}

.detail-actions {
    display: flex;
    gap: 12px;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-gray);
}

.action-item .material-symbols-rounded {
    font-size: 20px;
}
