/* 夏日留言板 v3 - 个人状态（心情）指示器与选择器 */

/* ==================== 双人心情卡片（融入头部第二行） ==================== */
/* 底色交给 header 的玻璃层，这里不再画渐变。渐变块压在玻璃上会让青橘色
   成为视觉主角，而内容反而退居其次。
   这里是一块全宽底板，不当 flex 容器 —— 横向布局交给 .mood-board-inner。 */
.mood-board {
    display: block;
    margin: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    position: relative;
    overflow: visible;
    width: 100%;
}

/* 内容区自带左右内距，与 .header-row-1 对齐（同样不复用 .container）。
   width:100% 是必须的：作为 flex 子项时默认 flex:0 1 auto，宽度由内容
   决定，两张卡会塌到左边，右侧空出一大块。 */
.mood-board-inner {
    display: flex;
    align-items: stretch;
    gap: 12px;
    width: 100%;
    padding: 4px 16px 6px;
    position: relative;
}

/* 顶部柔光、标题行分隔线、中缝竖线都已移除：渐变底色撤掉后柔光会在玻璃上
   留一团无来由的白晕；白卡之间的 8px 留白已经完成分隔的职责。 */

/* 单侧心情槽位：白色半透明卡片，浮在玻璃背景上 */
.mood-slot {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 9px 10px;
    /* 白卡背景 + 内描边 + 增强阴影 + 角色色渗透（默认 MDB 蓝绿） */
    background: linear-gradient(to bottom, 
        rgba(77, 208, 225, 0.05) 0%, 
        rgba(255, 255, 255, 0.68) 20%, 
        rgba(255, 255, 255, 0.68) 100%);
    border: 1px solid rgba(77, 208, 225, 0.22);
    border-radius: var(--radius-md);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06), 
                inset 0 1px 0 rgba(255, 255, 255, 0.6);
    font-family: inherit;
    text-align: center;
    transition: all var(--transition-fast);
}

.mood-slot-mine {
    cursor: pointer;
}

.mood-slot-mine:hover {
    background: linear-gradient(to bottom, 
        rgba(77, 208, 225, 0.08) 0%, 
        rgba(255, 255, 255, 0.78) 20%, 
        rgba(255, 255, 255, 0.78) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1), 
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border-color: rgba(77, 208, 225, 0.35);
}

.mood-slot-mine:active {
    transform: scale(0.98) translateY(0);
    background: linear-gradient(to bottom, 
        rgba(77, 208, 225, 0.10) 0%, 
        rgba(255, 255, 255, 0.72) 20%, 
        rgba(255, 255, 255, 0.72) 100%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 
                inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.mood-slot-mine:focus-visible {
    outline: 2px solid var(--mdb-primary);
    outline-offset: 2px;
}

/* 对方卡片：换 FJD 橘色渗透，左右一眼可分，不用读徽章 */
.mood-slot-other {
    background: linear-gradient(to bottom, 
        rgba(255, 138, 101, 0.05) 0%, 
        rgba(255, 255, 255, 0.68) 20%, 
        rgba(255, 255, 255, 0.68) 100%);
    border-color: rgba(255, 138, 101, 0.22);
}

.mood-slot-top {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
}

/* “我 / TA” 身份小标签 */
.mood-slot-who {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 1px 7px;
    border-radius: var(--radius-pill);
    color: white;
    background: linear-gradient(135deg, var(--mdb-primary), var(--mdb-dark));
    flex-shrink: 0;
}

.mood-slot-other .mood-slot-who {
    background: linear-gradient(135deg, var(--fjd-primary), var(--fjd-dark));
}

.mood-slot-emoji {
    font-size: 26px;
    line-height: 1.15;
}

/* 未设置时的占位符（＋ / －）：虚线圆环提示可点击 */
.mood-slot-emoji.is-empty {
    font-size: 18px;
    color: var(--text-tertiary);
    opacity: 0.6;
    width: 32px;
    height: 32px;
    border: 2px dashed var(--mood-ring);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 心情名称 */
.mood-slot-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 3px;
}

.mood-slot-emoji.is-empty + .mood-slot-label,
.mood-slot-label.is-empty {
    color: var(--text-tertiary);
    font-weight: 600;
}

/* 备注：压成单行，超出省略（方案 B 减高关键） */
.mood-slot-note {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-secondary);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 1px;
}

.mood-slot-note:empty {
    display: none;
}

/* 时间戳：11px + text-tertiary 对比度约 2.3:1，低于 AA 要求，
   这里升到 12px 并换 text-muted（约 3.4:1） */
.mood-slot-time {
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0.9;
}

.mood-slot-time:empty {
    display: none;
}

/* 夜间主题下白卡变成深色半透明，角色色渗透同步降到极淡 */
html[data-theme="night"] .mood-slot {
    background: linear-gradient(to bottom, 
        rgba(77, 208, 225, 0.10) 0%, 
        rgba(255, 255, 255, 0.08) 20%, 
        rgba(255, 255, 255, 0.08) 100%);
    border-color: rgba(77, 208, 225, 0.20);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22), 
                inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

html[data-theme="night"] .mood-slot-other {
    background: linear-gradient(to bottom, 
        rgba(255, 138, 101, 0.10) 0%, 
        rgba(255, 255, 255, 0.08) 20%, 
        rgba(255, 255, 255, 0.08) 100%);
    border-color: rgba(255, 138, 101, 0.20);
}

html[data-theme="night"] .mood-slot-mine:hover {
    background: linear-gradient(to bottom, 
        rgba(77, 208, 225, 0.16) 0%, 
        rgba(255, 255, 255, 0.13) 20%, 
        rgba(255, 255, 255, 0.13) 100%);
    border-color: rgba(77, 208, 225, 0.34);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28), 
                inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

html[data-theme="night"] .mood-slot-mine:active {
    background: linear-gradient(to bottom, 
        rgba(77, 208, 225, 0.18) 0%, 
        rgba(255, 255, 255, 0.11) 20%, 
        rgba(255, 255, 255, 0.11) 100%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.24), 
                inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* 夜间底色偏深，时间戳换回 tertiary（浅底才需要压深） */
html[data-theme="night"] .mood-slot-time {
    color: var(--text-tertiary);
}

/* 过期状态整体降饱和 */
.mood-slot.is-stale .mood-slot-emoji {
    filter: grayscale(1);
    opacity: 0.5;
}

.mood-slot.is-stale .mood-slot-label {
    color: var(--text-tertiary);
}

/* 刚更新时的强调动画。
   注意：不能用 background 做闪光 —— 卡片底色现在是角色色渐变，
   动画的 transparent 关键帧会把渐变整块抹掉，闪完才恢复。
   改用 box-shadow 外发光，不碰 background。 */
.mood-slot.just-updated {
    animation: moodSlotFlash 1.6s ease-out;
}

.mood-slot.just-updated .mood-slot-emoji {
    animation: moodPop 0.6s var(--transition-spring);
}

@keyframes moodSlotFlash {
    0%, 100% {
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06),
                    inset 0 1px 0 rgba(255, 255, 255, 0.6);
    }
    25% {
        box-shadow: 0 0 0 3px rgba(255, 241, 118, 0.55),
                    0 4px 14px rgba(255, 241, 118, 0.4),
                    inset 0 1px 0 rgba(255, 255, 255, 0.6);
    }
}

html[data-theme="night"] .mood-slot.just-updated {
    animation: moodSlotFlashNight 1.6s ease-out;
}

@keyframes moodSlotFlashNight {
    0%, 100% {
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22),
                    inset 0 1px 0 rgba(255, 255, 255, 0.06);
    }
    25% {
        box-shadow: 0 0 0 3px rgba(77, 208, 225, 0.45),
                    0 4px 14px rgba(77, 208, 225, 0.32),
                    inset 0 1px 0 rgba(255, 255, 255, 0.06);
    }
}

/* 宽屏：略放大字号，保持紧凑 */
@media (min-width: 768px) {
    .mood-board-inner {
        padding: 8px 0;
        gap: 14px;
    }

    .mood-slot {
        padding: 10px 12px;
    }

    .mood-slot-emoji {
        font-size: 30px;
    }

    .mood-slot-emoji.is-empty {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .mood-slot-label {
        font-size: 16px;
    }

    .mood-slot-note {
        font-size: 14px;
    }
}

/* 窄屏：压缩尺寸避免换行 */
@media (max-width: 360px) {
    .mood-board-inner {
        padding: 4px 0 6px;
        gap: 8px;
    }

    .mood-slot {
        padding: 7px 6px;
    }

    .mood-slot-emoji {
        font-size: 23px;
    }

    .mood-slot-emoji.is-empty {
        width: 29px;
        height: 29px;
        font-size: 15px;
    }

    .mood-slot-who {
        font-size: 11px;
        padding: 1px 6px;
    }

    .mood-slot-label {
        font-size: 14px;
    }
}


/* ==================== 心情选择器 ==================== */
.mood-option:focus-visible,
.mood-picker-close:focus-visible,
.btn-mood-clear:focus-visible,
.btn-mood-save:focus-visible {
    outline: 2px solid var(--mdb-primary);
    outline-offset: 2px;
}

.mood-picker {
    position: fixed;
    inset: 0;
    z-index: 520;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.mood-picker.active {
    display: flex;
    /* 防止移动端滚动穿透 */
    overscroll-behavior: contain;
}

.mood-picker-overlay {
    position: absolute;
    inset: 0;
    background: rgba(13, 43, 62, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: moodFadeIn 0.2s ease-out;
}

@keyframes moodFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.mood-picker-panel {
    position: relative;
    width: 100%;
    max-width: 360px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-card);
    animation: moodPanelIn 0.4s var(--transition-spring);
    /* 确保内容区域的触摸事件正常工作 */
    pointer-events: auto;
}

@keyframes moodPanelIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.mood-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.mood-picker-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}

.mood-picker-close {
    width: 30px;
    height: 30px;
    border: none;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    transition: all var(--transition-fast);
}

html[data-theme="night"] .mood-picker-close {
    background: rgba(255, 255, 255, 0.06);
}

.mood-picker-close:active {
    transform: scale(0.88);
}

.mood-picker-close svg {
    width: 100%;
    height: 100%;
}


/* 心情选项网格：改为分页模式，固定显示12个（3行×4列） */
.mood-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 12px;
    /* 移除滚动相关样式，改为固定高度 */
}

.mood-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px;
    border: 2px solid transparent;
    background: rgba(77, 208, 225, 0.06);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

/* 分页控制器 */
.mood-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
    padding: 8px 0;
}

.mood-page-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(77, 208, 225, 0.08);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    transition: all var(--transition-fast);
}

.mood-page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.mood-page-btn:not(:disabled):active {
    transform: scale(0.92);
    background: rgba(77, 208, 225, 0.16);
}

html[data-theme="night"] .mood-page-btn {
    background: rgba(255, 255, 255, 0.06);
}

.mood-page-btn svg {
    width: 100%;
    height: 100%;
}

.mood-page-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    user-select: none;
}

.mood-page-current {
    color: var(--mdb-primary);
    font-size: 17px;
}

.mood-page-divider {
    color: var(--text-tertiary);
    font-weight: 400;
}

html[data-theme="night"] .mood-option {
    background: rgba(255, 255, 255, 0.04);
}

.mood-option:active {
    transform: scale(0.92);
}

.mood-option.selected {
    border-color: var(--mdb-primary);
    background: rgba(77, 208, 225, 0.16);
}

.mood-option .emoji {
    font-size: 24px;
    line-height: 1.1;
}

.mood-option .label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.mood-option.selected .label {
    color: var(--mdb-dark);
}

html[data-theme="night"] .mood-option.selected .label {
    color: var(--mdb-light);
}

/* 附加说明输入 */
.mood-note-wrap {
    position: relative;
    margin-bottom: 16px;
}

.mood-note-input {
    width: 100%;
    padding: 11px 52px 11px 14px;
    border: 2px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

html[data-theme="night"] .mood-note-input {
    border-color: rgba(255, 255, 255, 0.08);
}

.mood-note-input:focus {
    border-color: var(--mdb-primary);
    box-shadow: 0 0 0 3px rgba(77, 208, 225, 0.12);
}

.mood-note-count {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--text-tertiary);
    pointer-events: none;
}

/* 底部操作按钮 */
.mood-picker-actions {
    display: flex;
    gap: 10px;
}

.btn-mood-clear,
.btn-mood-save {
    flex: 1;
    padding: 12px 18px;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-mood-clear {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
}

html[data-theme="night"] .btn-mood-clear {
    background: rgba(255, 255, 255, 0.06);
}

.btn-mood-save {
    background: linear-gradient(135deg, var(--mdb-primary), var(--mdb-dark));
    color: white;
    box-shadow: 0 4px 16px rgba(77, 208, 225, 0.3);
}

.btn-mood-clear:active,
.btn-mood-save:active {
    transform: scale(0.96);
}

.btn-mood-save:disabled,
.btn-mood-clear:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* ==================== FJD 角色配色覆盖 ==================== */
body[data-identity="FJD"] .mood-option.selected {
    border-color: var(--fjd-primary);
    background: rgba(255, 138, 101, 0.16);
}

body[data-identity="FJD"] .mood-option.selected .label {
    color: var(--fjd-dark);
}

html[data-theme="night"] body[data-identity="FJD"] .mood-option.selected .label {
    color: var(--fjd-light);
}

body[data-identity="FJD"] .mood-note-input:focus {
    border-color: var(--fjd-primary);
    box-shadow: 0 0 0 3px rgba(255, 138, 101, 0.12);
}

body[data-identity="FJD"] .btn-mood-save {
    background: linear-gradient(135deg, var(--fjd-primary), var(--fjd-dark));
    box-shadow: 0 4px 16px rgba(255, 138, 101, 0.3);
}

body[data-identity="FJD"] .mood-slot-mine:focus-visible,
body[data-identity="FJD"] .mood-option:focus-visible,
body[data-identity="FJD"] .btn-mood-save:focus-visible {
    outline-color: var(--fjd-primary);
}

body[data-identity="FJD"] .mood-slot-mine:active {
    background: linear-gradient(to bottom, 
        rgba(255, 138, 101, 0.10) 0%, 
        rgba(255, 255, 255, 0.72) 20%, 
        rgba(255, 255, 255, 0.72) 100%);
}

/* FJD 登录时左右身份色对调：我=橘红，TA(MDB)=蓝绿 */
body[data-identity="FJD"] .mood-slot-mine {
    background: linear-gradient(to bottom, 
        rgba(255, 138, 101, 0.05) 0%, 
        rgba(255, 255, 255, 0.68) 20%, 
        rgba(255, 255, 255, 0.68) 100%);
    border-color: rgba(255, 138, 101, 0.22);
}

body[data-identity="FJD"] .mood-slot-other {
    background: linear-gradient(to bottom, 
        rgba(77, 208, 225, 0.05) 0%, 
        rgba(255, 255, 255, 0.68) 20%, 
        rgba(255, 255, 255, 0.68) 100%);
    border-color: rgba(77, 208, 225, 0.22);
}

body[data-identity="FJD"] .mood-slot-mine:hover {
    background: linear-gradient(to bottom, 
        rgba(255, 138, 101, 0.08) 0%, 
        rgba(255, 255, 255, 0.78) 20%, 
        rgba(255, 255, 255, 0.78) 100%);
    border-color: rgba(255, 138, 101, 0.35);
}

body[data-identity="FJD"] .mood-slot-mine .mood-slot-who {
    background: linear-gradient(135deg, var(--fjd-primary), var(--fjd-dark));
}

body[data-identity="FJD"] .mood-slot-other .mood-slot-who {
    background: linear-gradient(135deg, var(--mdb-primary), var(--mdb-dark));
}

/* FJD 夜间模式 */
html[data-theme="night"] body[data-identity="FJD"] .mood-slot-mine {
    background: linear-gradient(to bottom, 
        rgba(255, 138, 101, 0.10) 0%, 
        rgba(255, 255, 255, 0.08) 20%, 
        rgba(255, 255, 255, 0.08) 100%);
    border-color: rgba(255, 138, 101, 0.20);
}

html[data-theme="night"] body[data-identity="FJD"] .mood-slot-other {
    background: linear-gradient(to bottom, 
        rgba(77, 208, 225, 0.10) 0%, 
        rgba(255, 255, 255, 0.08) 20%, 
        rgba(255, 255, 255, 0.08) 100%);
    border-color: rgba(77, 208, 225, 0.20);
}

html[data-theme="night"] body[data-identity="FJD"] .mood-slot-mine:hover {
    background: linear-gradient(to bottom, 
        rgba(255, 138, 101, 0.16) 0%, 
        rgba(255, 255, 255, 0.13) 20%, 
        rgba(255, 255, 255, 0.13) 100%);
    border-color: rgba(255, 138, 101, 0.34);
}

html[data-theme="night"] body[data-identity="FJD"] .mood-slot-mine:active {
    background: linear-gradient(to bottom, 
        rgba(255, 138, 101, 0.18) 0%, 
        rgba(255, 255, 255, 0.11) 20%, 
        rgba(255, 255, 255, 0.11) 100%);
}
