/* ============================================================
   css/clothing.css - 🎀 衣柜（wardrobe 模态）样式
   依赖 global.css 的 gb-modal / gb-btn / stab（商店同款 tab）变量
   ============================================================ */

.wd-wrap { display: flex; gap: 14px; align-items: flex-start; }

/* ---- 左侧：实时预览 ---- */
.wd-preview {
    flex: 0 0 168px;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    background: var(--card-bg, #fff7ec);
    border: 2px solid var(--line, #f0e0c8);
    border-radius: 16px; padding: 12px 10px;
    position: sticky; top: 0;
}
.wd-preview #wd-dog { width: 120px; height: 120px; }
.wd-worn { font-size: 0.9rem; color: var(--text-soft, #8a7a66); }
.wd-strip { font-size: 0.85rem; }

/* ---- 右侧：分类 tab + 卡片网格 ---- */
.wd-main { flex: 1 1 auto; min-width: 0; }
.wd-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.wd-tabs .stab {
    border: 1.5px solid var(--line, #f0e0c8); background: var(--card-bg, #fff);
    border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 0.9rem;
    color: var(--text, #5b4a3a);
}
.wd-tabs .stab.on { background: var(--pink-deep, #e8738f); color: #fff; border-color: var(--pink-deep, #e8738f); }

.wd-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 10px;
}
.wd-card {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: var(--card-bg, #fff);
    border: 2px solid var(--line, #f0e0c8);
    border-radius: 14px; padding: 10px 6px 8px; cursor: pointer;
    text-align: center; user-select: none;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.wd-card:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,.06); }
.wd-card:active { transform: scale(.96); }          /* 轻微缩放反馈，不阻塞操作 */
.wd-card .wd-ico { font-size: 1.9rem; line-height: 1.2; }
.wd-card .wd-name { font-size: 0.9rem; font-weight: 600; color: var(--text, #5b4a3a); }
.wd-card .wd-cat { font-size: 0.72rem; color: var(--text-soft, #a09484); }
.wd-card .wd-chip { font-size: 0.78rem; margin-top: 2px; border-radius: 999px; padding: 1px 8px; }
/* 一键穿脱 chip：按钮化（字体继承 + 足够的点击面积） */
button.wd-chip { font-family: inherit; border: none; cursor: pointer; padding: 2.5px 10px; line-height: 1.4; }
.wd-card .wd-chip.wd-quick:active { transform: scale(0.92); }
.wd-card.owned .wd-quick { background: #e3f2e3; color: #3d7a3d; }
.wd-card.owned .wd-quick:hover { background: #d4ebd4; }
.wd-card.covered .wd-quick { background: #efe9df; color: #7a6a56; }
.wd-card.worn .wd-quick { background: var(--pink-deep, #e8738f); color: #fff; }
.wd-card.worn .wd-quick:hover { background: #d9607d; }

/* 状态着色 */
.wd-card.worn { border-color: var(--pink-deep, #e8738f); background: #fdeef2; }
.wd-card.worn .wd-chip { background: var(--pink-deep, #e8738f); color: #fff; }
.wd-card.owned .wd-chip { background: #e3f2e3; color: #3d7a3d; }
.wd-card.covered { opacity: .75; }
.wd-card.covered .wd-chip { background: #efe9df; color: #8a7a66; }
.wd-card.locked { opacity: .6; filter: saturate(.7); }
.wd-card.locked .wd-chip { background: #f1e9dd; color: #9a8a74; }

/* 稀有度描边（与商店语义一致） */
.wd-card.r-uncommon { border-color: #9ccc9c; }
.wd-card.r-rare { border-color: #8fb8e8; }
.wd-card.r-epic { border-color: #c9a2e8; }
.wd-card.r-festival { border-color: #e8b06a; background: #fff8ec; }
.wd-card.r-legendary { border-color: #e8c377; box-shadow: 0 0 0 1.5px #f2e2b0 inset; }
.wd-card.selected { border-color: var(--pink-deep, #e8738f); box-shadow: 0 0 0 2px rgba(232,115,143,.25); }

/* 限定 / 稀有度徽章 */
.wd-badge {
    display: inline-block; font-size: 0.72rem; border-radius: 999px;
    padding: 1px 8px; margin-top: 3px; background: #fdeef2; color: #c05470;
}
.wd-badge.festival { background: #fff2dc; color: #b8802e; }
.wd-badge.legendary { background: #fdf3d7; color: #a8842e; }

/* ---- 商店试穿预览盒（衣服 tab） ---- */
.shop-preview {
    display: flex; align-items: center; gap: 10px;
    background: var(--card-bg, #fff7ec); border: 2px solid var(--line, #f0e0c8);
    border-radius: 14px; padding: 6px 12px; margin-bottom: 10px;
}
.shop-preview #sp-dog { width: 84px; height: 84px; flex: none; }
.shop-preview .sp-note { font-size: 0.88rem; color: var(--text-soft, #8a7a66); }

/* 商店卡片上的限定徽章 */
.shop-item { position: relative; }
.shop-item .si-badge {
    position: absolute; top: 4px; right: 6px;
    font-size: 0.62rem; border-radius: 999px; padding: 1px 6px;
    background: #fff2dc; color: #b8802e; white-space: nowrap;
}

/* ---- 详情面板 ---- */
.wd-detail {
    margin-top: 10px; background: var(--card-bg, #fff7ec);
    border: 2px solid var(--line, #f0e0c8); border-radius: 14px; padding: 10px 12px;
    font-size: 0.9rem; color: var(--text, #5b4a3a);
}
/* ★ 头部一行：名称+徽章在左，穿上/去商店按钮在右 —— 不用再滚到底部找按钮 */
.wd-detail .dt-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; flex-wrap: wrap;
}
.wd-detail .dt-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.wd-detail .dt-name { font-weight: 700; font-size: 1rem; }
.wd-detail .dt-row { margin-top: 4px; color: var(--text-soft, #7a6a56); font-size: 0.85rem; }
.wd-detail .dt-row b { color: var(--text, #5b4a3a); font-weight: 600; }
.wd-detail .dt-btns { display: flex; gap: 8px; flex: none; }

/* ---- 今日推荐 ---- */
.wd-reco {
    display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
    background: linear-gradient(90deg, #fff6e3, #fdeef2);
    border: 1.5px dashed #e8c8a0; border-radius: 12px; padding: 7px 12px;
    font-size: 0.88rem; color: #8a6a48;
}
.wd-reco .rc-ico { font-size: 1.2rem; }
.wd-reco .rc-set { font-weight: 700; color: #b8802e; }

/* ============================================================
   服装特效动画（低频、轻量：粒子 ≤6 个，慢循环）
   ============================================================ */
.dog-fx { pointer-events: none; }
.cl-fx circle, .cl-fx path, .cl-fx rect { will-change: transform, opacity; }

/* 月光粒子：缓缓上浮 + 淡入淡出 */
.cl-fx-moon circle { animation: cl-float-up 5.2s ease-in-out infinite; }
.cl-fx-moon path   { animation: cl-twinkle 3.6s ease-in-out infinite; }
/* 星光闪烁 */
.cl-fx-spark path { animation: cl-twinkle 2.8s ease-in-out infinite; transform-origin: center; }
.cl-fx-spark path:nth-of-type(2) { animation-delay: .9s; }
.cl-fx-spark path:nth-of-type(3) { animation-delay: 1.7s; }
.cl-fx-spark path:nth-of-type(4) { animation-delay: 2.3s; }
/* 金色微光 */
.cl-fx-gold circle { animation: cl-twinkle 3.2s ease-in-out infinite; }
.cl-fx-gold circle:nth-of-type(2) { animation-delay: .8s; }
.cl-fx-gold circle:nth-of-type(3) { animation-delay: 1.6s; }
.cl-fx-gold circle:nth-of-type(4) { animation-delay: 2.4s; }
/* 小雨滴：轻轻下落 */
.cl-fx-rain line { animation: cl-rain-fall 1.9s linear infinite; }
.cl-fx-rain line:nth-of-type(2) { animation-delay: .55s; }
.cl-fx-rain line:nth-of-type(3) { animation-delay: 1.1s; }
.cl-fx-rain line:nth-of-type(4) { animation-delay: 1.55s; }
/* 彩带：飘落 + 旋转 */
.cl-fx-conf rect, .cl-fx-conf path { animation: cl-confetti 4.2s linear infinite; }
.cl-fx-conf :nth-of-type(2) { animation-delay: .8s; }
.cl-fx-conf :nth-of-type(3) { animation-delay: 1.7s; }
.cl-fx-conf :nth-of-type(4) { animation-delay: 2.5s; }
.cl-fx-conf :nth-of-type(5) { animation-delay: 3.2s; }
/* 灯笼微晃（由素材自带 .cl-sway 组） */
.dog-holder .cl-sway { animation: cl-sway 3.4s ease-in-out infinite; }

@keyframes cl-float-up {
    0% { transform: translateY(3px); opacity: 0; }
    30% { opacity: .85; }
    100% { transform: translateY(-9px); opacity: 0; }
}
@keyframes cl-twinkle {
    0%, 100% { opacity: .15; transform: scale(.7); }
    50% { opacity: .95; transform: scale(1.05); }
}
@keyframes cl-rain-fall {
    0% { transform: translateY(-5px); opacity: 0; }
    25% { opacity: .8; }
    80% { opacity: .6; }
    100% { transform: translateY(12px); opacity: 0; }
}
@keyframes cl-confetti {
    0% { transform: translateY(-4px) rotate(0deg); opacity: 0; }
    20% { opacity: .9; }
    100% { transform: translateY(16px) rotate(140deg); opacity: 0; }
}
@keyframes cl-sway {
    0%, 100% { transform: rotate(-4deg); }
    50% { transform: rotate(4deg); }
}
/* 减少动态偏好：特效粒子静止 */
@media (prefers-reduced-motion: reduce) {
    .cl-fx * { animation: none !important; }
    .dog-holder .cl-sway { animation: none !important; }
}

/* ---- 窄屏（手机竖屏）：预览吸顶 + 详情吸底，穿脱不必上下找 ---- */
@media (max-width: 480px) {
    .wd-wrap { flex-direction: column; }
    /* 预览行：吸在弹窗滚动区顶部，滚动网格时随时能看到狗宝换装效果 */
    .wd-preview {
        flex: none; width: 100%; flex-direction: row; justify-content: center;
        position: sticky; top: -8px; z-index: 8;
        box-shadow: 0 4px 12px rgba(120, 90, 60, .12);
    }
    .wd-preview #wd-dog { width: 84px; height: 84px; }
    /* 网格更密：一屏能看到的衣服更多 */
    .wd-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
    /* ★ 详情面板吸底：点任意卡片，穿上/去商店按钮永远悬在底部可见处 */
    .wd-detail {
        position: sticky; bottom: -18px; z-index: 8;
        box-shadow: 0 -6px 16px rgba(120, 90, 60, .16);
        margin-bottom: -8px;
    }
}
