/*!
 * 匿名表白墙 & 许愿池 confession-wall.css
 * 便利贴留言墙：左侧投递纸条 + 右侧贴墙，含虚拟礼物 / 心动互动
 * 便利贴在亮/暗主题下均保持手账暖纸色，依赖 home.css 变量，完整适配黑夜模式
 */

.cw-page { --cw-pink: #ff2d78; --cw-pink-soft: rgba(255, 45, 120, .1); --cw-gold: #f5a623; }

/* ======================================================================
 *  模式切换
 * ==================================================================== */
.cw-modebar {
    position: relative;
    display: inline-flex;
    gap: 4px;
    margin: 4px 0 22px;
    padding: 5px;
    background: var(--c-bg-card, #fff);
    border: 1px solid var(--c-border, #eef1f6);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
}
.cw-mode {
    position: relative;
    z-index: 1;
    height: 42px;
    padding: 0 26px;
    font-size: 14.5px;
    font-weight: 800;
    color: var(--c-text-sub, #5b6478);
    background: transparent;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    transition: color .18s;
}
.cw-mode.is-active { color: #fff; }
.cw-page[data-mode="love"] .cw-mode.is-active {
    background: linear-gradient(135deg, #ff5f9e, #ff2d78);
    box-shadow: 0 6px 16px rgba(255, 45, 120, .32);
}
.cw-page[data-mode="wish"] .cw-mode.is-active {
    background: linear-gradient(135deg, #ffc24b, #f59914);
    box-shadow: 0 6px 16px rgba(245, 154, 20, .34);
}
.cw-mode-deco { display: none; }

/* ======================================================================
 *  布局
 * ==================================================================== */
.cw-layout {
    display: grid;
    grid-template-columns: 328px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.cw-side {
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 104px);
    overflow-y: auto;
}
.cw-composer { padding: 18px; margin: 0; }

.cw-composer-head { display: flex; align-items: center; gap: 11px; margin-bottom: 16px; }
.cw-composer-emoji {
    font-size: 26px;
    width: 46px;
    height: 46px;
    line-height: 46px;
    text-align: center;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255, 95, 158, .16), rgba(255, 45, 120, .08));
}
.cw-page[data-mode="wish"] .cw-composer-emoji {
    background: linear-gradient(135deg, rgba(255, 194, 75, .22), rgba(245, 154, 20, .1));
}
.cw-composer-title { font-size: 15.5px; font-weight: 800; color: var(--c-text, #1a1f36); }
.cw-composer-sub { font-size: 11.5px; color: var(--c-text-muted, #8a93a8); margin-top: 2px; }

.cw-field { margin-bottom: 14px; }
.cw-field label {
    display: block;
    font-size: 12.5px;
    font-weight: 800;
    color: var(--c-text-muted, #8a93a8);
    margin-bottom: 7px;
}
.cw-field label em {
    margin-left: 5px;
    font-style: normal;
    font-weight: 600;
    color: var(--cw-pink, #ff2d78);
}
.cw-gift-label { margin-bottom: 8px !important; }

.cw-input,
.cw-text {
    display: block;
    width: 100%;
    padding: 10px 12px;
    font-size: 13.5px;
    color: var(--c-text, #0f172a);
    background: var(--c-surface-soft, #f7f9fc);
    border: 1px solid var(--c-border, #e2e8f0);
    border-radius: 10px;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
}
.cw-text { min-height: 104px; line-height: 1.8; resize: vertical; font-size: 14px; }
.cw-input:focus, .cw-text:focus {
    border-color: var(--cw-pink, #ff2d78);
    box-shadow: 0 0 0 3px rgba(255, 45, 120, .1);
}
.cw-page[data-mode="wish"] .cw-input:focus,
.cw-page[data-mode="wish"] .cw-text:focus {
    border-color: var(--cw-gold, #f59914);
    box-shadow: 0 0 0 3px rgba(245, 154, 20, .14);
}

.cw-anon {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--c-text-sub, #5b6478);
    cursor: pointer;
    user-select: none;
}
.cw-anon input { width: 15px; height: 15px; accent-color: var(--cw-pink, #ff2d78); }

/* 礼物选择 */
.cw-gifts { display: flex; flex-wrap: wrap; gap: 7px; }
.cw-gift {
    width: 38px;
    height: 38px;
    font-size: 18px;
    line-height: 1;
    background: var(--c-surface-soft, #f6f8fc);
    border: 2px solid var(--c-border, #eef1f6);
    border-radius: 11px;
    cursor: pointer;
    font-family: inherit;
    transition: transform .12s, border-color .12s, background .12s;
}
.cw-gift:hover { transform: translateY(-2px); }
.cw-gift.is-active {
    border-color: var(--cw-pink, #ff2d78);
    background: rgba(255, 45, 120, .08);
    transform: translateY(-2px) scale(1.05);
}
.cw-page[data-mode="wish"] .cw-gift.is-active {
    border-color: var(--cw-gold, #f59914);
    background: rgba(245, 154, 20, .12);
}

.cw-submit {
    width: 100%;
    height: 46px;
    margin-top: 2px;
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #ff5f9e, #ff2d78);
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 8px 20px rgba(255, 45, 120, .3);
    transition: transform .15s, box-shadow .15s, filter .15s;
}
.cw-submit:hover { transform: translateY(-1px); filter: brightness(1.03); }
.cw-page[data-mode="wish"] .cw-submit {
    background: linear-gradient(135deg, #ffc24b, #f59914);
    box-shadow: 0 8px 20px rgba(245, 154, 20, .3);
}
.cw-side-note {
    margin: 12px 0 0;
    font-size: 11px;
    line-height: 1.7;
    color: var(--c-text-muted, #8a93a8);
}
.cw-side-note b { color: var(--c-text-sub, #5b6478); }

/* ======================================================================
 *  右侧工具栏 + 墙
 * ==================================================================== */
.cw-main { min-width: 0; }

.cw-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    margin-bottom: 20px;
    background: var(--c-bg-card, #fff);
    border: 1px solid var(--c-border, #eef1f6);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}
.cw-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.cw-stat {
    font-size: 12.5px;
    color: var(--c-text-muted, #8a93a8);
    background: var(--c-surface-soft, #f1f5f9);
    border-radius: 999px;
    padding: 4px 12px;
}
.cw-stat b { color: var(--c-text, #0f172a); font-size: 13.5px; font-weight: 800; margin-left: 2px; }
.cw-filters { display: inline-flex; gap: 6px; margin-left: auto; }
.cw-filter {
    height: 32px;
    padding: 0 15px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--c-text-sub, #5b6478);
    background: var(--c-surface-soft, #f1f5f9);
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
}
.cw-filter:hover { color: var(--cw-pink, #ff2d78); }
.cw-filter.is-active { color: #fff; background: linear-gradient(135deg, #ff5f9e, #ff2d78); }
.cw-page[data-mode="wish"] .cw-filter:hover { color: var(--cw-gold, #f59914); }
.cw-page[data-mode="wish"] .cw-filter.is-active { background: linear-gradient(135deg, #ffc24b, #f59914); }

/* 便利贴网格 */
.cw-wall {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
    gap: 20px 18px;
    align-items: start;
}

/* ============================== 便利贴 ============================== */
.cw-note {
    position: relative;
    padding: 22px 16px 12px;
    border-radius: 3px 3px 10px 10px;
    color: #4b3f24;
    box-shadow: 0 2px 4px rgba(15, 23, 42, .08), 0 10px 22px -10px rgba(15, 23, 42, .25);
    transition: transform .18s ease, box-shadow .18s ease;
    word-break: break-word;
    animation: cwIn .3s ease;
}
@keyframes cwIn {
    from { opacity: 0; transform: scale(.9) rotate(0deg); }
    to { opacity: 1; }
}
.cw-note:hover {
    transform: rotate(0deg) translateY(-4px) !important;
    box-shadow: 0 6px 10px rgba(15, 23, 42, .1), 0 18px 34px -12px rgba(15, 23, 42, .32);
    z-index: 2;
}

/* 图钉 */
.cw-note::before {
    content: '';
    position: absolute;
    top: -7px;
    left: 50%;
    width: 14px;
    height: 14px;
    margin-left: -7px;
    border-radius: 50%;
    background: radial-gradient(circle at 34% 30%, #ff8a8a, #d83a4b 62%, #a52130);
    box-shadow: 0 2px 4px rgba(15, 23, 42, .35);
}

/* 五种手账配色 */
.cw-note--c1 { background: #fff3b0; }
.cw-note--c2 { background: #ffd9e8; }
.cw-note--c3 { background: #cdf2dd; }
.cw-note--c4 { background: #d7e9ff; }
.cw-note--c5 { background: #e9ddff; }

/* 倾斜节奏 */
.cw-note:nth-child(5n+1) { transform: rotate(-1.4deg); }
.cw-note:nth-child(5n+2) { transform: rotate(1.1deg); }
.cw-note:nth-child(5n+3) { transform: rotate(-0.6deg); }
.cw-note:nth-child(5n+4) { transform: rotate(1.6deg); }

.cw-note-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.cw-note-to {
    font-size: 12px;
    font-weight: 800;
    color: #9b6a1f;
    letter-spacing: .02em;
}
.cw-note--c2 .cw-note-to { color: #b32763; }
.cw-note--c3 .cw-note-to { color: #1f7a4d; }
.cw-note--c4 .cw-note-to { color: #2357a6; }
.cw-note--c5 .cw-note-to { color: #6d3fc0; }
.cw-note-gift { font-size: 22px; line-height: 1; cursor: default; filter: drop-shadow(0 1px 1px rgba(0,0,0,.12)); }

.cw-note-text {
    margin: 0 0 12px;
    font-family: "KaiTi", "STKaiti", "楷体", "Kaiti SC", "Songti SC", serif;
    font-size: 15.5px;
    line-height: 1.95;
    color: #3f3520;
    white-space: pre-wrap;
}

.cw-note-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    color: rgba(75, 63, 36, .62);
    margin-bottom: 9px;
}
.cw-note-from { font-weight: 700; }
.cw-note-from::before { content: '—— '; }

.cw-note-actions { display: flex; gap: 8px; border-top: 1px dashed rgba(75, 63, 36, .22); padding-top: 9px; }
.cw-act {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 28px;
    padding: 0 11px;
    font-size: 12px;
    font-weight: 700;
    color: #6b5d3f;
    background: rgba(255, 255, 255, .55);
    border: 1px solid rgba(75, 63, 36, .14);
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    transition: transform .12s, background .12s;
}
.cw-act:hover { transform: scale(1.06); background: rgba(255, 255, 255, .85); }
.cw-act.is-on { color: #e02c6a; background: rgba(255, 45, 120, .14); border-color: rgba(255, 45, 120, .3); }
.cw-act b { font-variant-numeric: tabular-nums; }

.cw-note-tag {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 10px;
    font-weight: 800;
    color: #b32763;
    background: rgba(255, 255, 255, .6);
    padding: 1px 7px;
    border-radius: 999px;
}
/* 有礼物时右上角留给 tag，礼物放 meta 行 */
.cw-note-giftline { font-size: 12px; color: rgba(75,63,36,.7); margin-bottom: 8px; }
.cw-note-giftline .g { font-size: 15px; }

/* 飘出的表情 */
.cw-float-emoji {
    position: absolute;
    font-size: 20px;
    pointer-events: none;
    animation: cwFloat 0.9s ease-out forwards;
    z-index: 5;
}
@keyframes cwFloat {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-46px) scale(1.5); }
}

/* 空状态 */
.cw-empty {
    grid-column: 1 / -1;
    padding: 60px 20px;
    text-align: center;
    color: var(--c-text-muted, #8a93a8);
    background: var(--c-bg-card, #fff);
    border: 1px dashed var(--c-border, #e2e8f0);
    border-radius: 16px;
}
.cw-empty-emoji { font-size: 44px; margin-bottom: 10px; }
.cw-empty p { margin: 0; font-size: 14px; }

.cw-tips {
    margin: 22px 2px 0;
    font-size: 12.5px;
    line-height: 2;
    color: var(--c-text-muted, #8a93a8);
}
.cw-tips b { color: var(--c-text-sub, #5b6478); font-weight: 700; }

/* ======================================================================
 *  轻提示
 * ==================================================================== */
.cw-toast {
    position: fixed;
    left: 50%;
    bottom: 44px;
    transform: translate(-50%, 16px);
    padding: 11px 22px;
    font-size: 13.5px;
    font-weight: 600;
    color: #fff;
    background: rgba(15, 23, 42, .93);
    border-radius: 999px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 999;
}
.cw-toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ======================================================================
 *  响应式
 * ==================================================================== */
@media (max-width: 1024px) {
    .cw-layout { grid-template-columns: minmax(0, 1fr); }
    .cw-side { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 640px) {
    .cw-mode { padding: 0 18px; height: 38px; font-size: 13.5px; }
    .cw-modebar { display: flex; width: 100%; justify-content: center; }
    .cw-composer { padding: 15px; }
    .cw-bar { padding: 10px 12px; gap: 10px; }
    .cw-filters { margin-left: 0; width: 100%; }
    .cw-filter { flex: 1; }
    .cw-wall { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 16px 12px; }
    .cw-note { padding: 20px 12px 10px; }
    .cw-note-text { font-size: 14.5px; }
}

/* 侧栏滚动条（桌面） */
@media (min-width: 1025px) {
    .cw-side::-webkit-scrollbar { width: 6px; }
    .cw-side::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
    .cw-side::-webkit-scrollbar-track { background: transparent; }
}

/* ======================================================================
 *  黑夜模式：仅外围控件变暗，便利贴保持暖纸本色（像真便利贴贴在墙上）
 * ==================================================================== */
[data-theme="dark"] .cw-modebar,
[data-theme="dark"] .cw-composer,
[data-theme="dark"] .cw-bar,
[data-theme="dark"] .cw-empty {
    background: var(--c-bg-card, #131c31);
    border-color: rgba(255, 255, 255, .08);
}
[data-theme="dark"] .cw-input,
[data-theme="dark"] .cw-text,
[data-theme="dark"] .cw-gift,
[data-theme="dark"] .cw-filter,
[data-theme="dark"] .cw-stat {
    background: rgba(255, 255, 255, .05);
    border-color: rgba(255, 255, 255, .12);
    color: var(--c-text-sub, #9ca3af);
}
[data-theme="dark"] .cw-input,
[data-theme="dark"] .cw-text { color: var(--c-text, #e5e7eb); }
[data-theme="dark"] .cw-composer-title,
[data-theme="dark"] .cw-stat b { color: var(--c-text, #e5e7eb); }
[data-theme="dark"] .cw-filter.is-active { color: #fff; }
[data-theme="dark"] .cw-note {
    box-shadow: 0 2px 6px rgba(0, 0, 0, .4), 0 14px 28px -12px rgba(0, 0, 0, .55);
}
