/* --- Moments (朋友圈) Screen Styles --- */

#moments-screen {
    background-color: #ffffff;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
}

#moments-screen.active {
    display: flex;
}

.moments-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: calc(60px + env(safe-area-inset-top));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: env(safe-area-inset-top) 15px 0;
    z-index: 10;
    background: transparent;
    transition: background-color 0.3s ease;
}

.moments-header.scrolled {
    background-color: #ededed;
    border-bottom: 1px solid #e5e5e5;
}

.moments-header .back-btn,
.moments-header .action-btn {
    background: rgba(0, 0, 0, 0.3);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.moments-header.scrolled .back-btn,
.moments-header.scrolled .action-btn {
    background: transparent;
    color: #333;
}

.moments-header .title-container {
    flex: 1;
    text-align: center;
}

.moments-header .title {
    font-size: 17px;
    font-weight: bold;
    color: #333;
    margin: 0;
}

.moments-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Cover Area */
.moments-cover-area {
    position: relative;
    width: 100%;
    height: 300px;
    background-color: #333;
    margin-bottom: 40px;
}

.moments-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.moments-user-info {
    position: absolute;
    right: 15px;
    bottom: -25px;
    display: flex;
    align-items: flex-end;
    gap: 15px;
}

.moments-user-name {
    color: white;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    margin-bottom: 30px;
}

.moments-user-avatar {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    border: 2px solid white;
    background-color: #fff;
    object-fit: cover;
}

.moments-user-signature {
    position: absolute;
    right: 15px;
    bottom: -45px;
    color: #666;
    font-size: 13px;
    text-align: right;
    max-width: 70%;
    word-wrap: break-word;
}

/* Feed Area */
.moments-feed {
    padding: 0;
}

.moment-item {
    display: flex;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.moment-avatar {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    margin-right: 10px;
    flex-shrink: 0;
    object-fit: cover;
}

.moment-main {
    flex: 1;
    min-width: 0;
}

.moment-name {
    color: #576b95;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
}

.moment-text {
    font-size: 15px;
    color: #333;
    line-height: 1.5;
    margin-bottom: 10px;
    word-wrap: break-word;
}

.moment-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 5px;
    margin-bottom: 10px;
    max-width: 80%;
}

.moment-images.single {
    grid-template-columns: 1fr;
    max-width: 60%;
}

.moment-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 4px;
}

.moment-images.single .moment-img {
    aspect-ratio: auto;
    max-height: 200px;
}

.moment-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    position: relative;
}

.moment-time {
    font-size: 12px;
    color: #b2b2b2;
}

.moment-action-btn {
    background: #f5f5f5;
    border: none;
    border-radius: 4px;
    width: 32px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #576b95;
    font-weight: bold;
    letter-spacing: 2px;
}

/* Interaction Area (Likes & Comments) */
.moment-interaction {
    background-color: #f7f7f7;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 13px;
    position: relative;
}

.moment-interaction::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 15px;
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent #f7f7f7 transparent;
}

.moment-likes {
    color: #576b95;
    font-weight: 500;
    padding: 5px 0;
    display: flex;
    align-items: center;
    gap: 5px;
    border-bottom: 1px solid #ebebeb;
}

.moment-likes svg {
    width: 12px;
    height: 12px;
    fill: #576b95;
}

.moment-comments {
    padding: 5px 0;
}

.moment-comment {
    margin-bottom: 3px;
    line-height: 1.4;
}

.moment-comment-name {
    color: #576b95;
    font-weight: 500;
}

.moment-comment-text {
    color: #333;
}

/* Comment Input Area */
.moments-comment-input-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #f5f5f5;
    padding: 10px 15px calc(10px + env(safe-area-inset-bottom));
    display: flex;
    gap: 10px;
    border-top: 1px solid #ddd;
    z-index: 20;
}

.moments-comment-input-area input {
    flex: 1;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
    -webkit-user-select: text;
    user-select: text;
}

/* Action Popup */
.moment-action-popup {
    position: absolute;
    right: 40px;
    top: -10px;
    background: #4c5154;
    border-radius: 4px;
    display: flex;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateX(10px);
    transition: all 0.2s ease;
}

.moment-action-popup.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.moment-action-item {
    color: white;
    padding: 4px 10px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    white-space: nowrap;
}

.moment-action-item:first-child {
    border-right: 1px solid #3a3e40;
}

.moment-image-wrapper {
    position: relative;
    cursor: pointer;
}

.moment-image-curtain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f5f5f5;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    overflow: hidden; /* 保证图片不会超出圆角 */
}

.moment-image-curtain img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.moment-image-wrapper.show-text .moment-image-curtain {
    opacity: 0;
    pointer-events: none;
}

.curtain-hint {
    position: absolute;
    bottom: 5px;
    left: 8px;
    color: #999;
    font-size: 12px;
    text-shadow: 0 0 2px white; /* 给文字加一点描边，使其在各种背景下都清晰 */
}

.moment-image-description-text {
    background-color: #ffffff;
    color: #333;
    padding: 20px;
    border-radius: 4px;
    font-size: 15px;
    line-height: 1.6;
    border: 1px solid #f0f0f0;
    word-wrap: break-word;
    min-height: 50px; /* 保证一个最小高度 */
}
