/* ============================================================
   微社区 · 社交社区平台（手机端）
   设计：浅色内容 + 霓虹渐变强调色（magenta→violet→cyan）
   桌面端以"手机设备"呈现，窄屏铺满真机
   ============================================================ */

/* 桌面背景：深色光晕，让白色手机悬浮更醒目 */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
    min-height: 100vh;
    font-family: "PingFang SC","Microsoft YaHei",system-ui,-apple-system,"Segoe UI",sans-serif;
    color: #1f2330;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    background:
        radial-gradient(900px 700px at 15% -10%, #2a1640 0%, transparent 60%),
        radial-gradient(800px 600px at 110% 110%, #0e2a36 0%, transparent 55%),
        linear-gradient(160deg, #0d0a18 0%, #100c1c 100%);
    background-attachment: fixed;
}

/* ---------- 手机设备外壳 ---------- */
.device {
    padding: 12px;
    background: linear-gradient(160deg, #23232f, #0c0c14);
    border-radius: 54px;
    box-shadow: 0 40px 90px rgba(0,0,0,.55), inset 0 0 0 2px rgba(255,255,255,.04);
}
.phone {
    position: relative;
    width: 390px; max-width: calc(100vw - 44px);
    height: 824px; max-height: calc(100vh - 60px);
    background: #f5f6fb;
    border-radius: 44px;
    overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: inset 0 0 0 2px rgba(0,0,0,.35);
}
/* 刘海 */
.notch {
    position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 150px; height: 26px; background: #0c0c14; border-radius: 0 0 16px 16px; z-index: 30;
}
/* 状态栏 */
.statusbar {
    height: 30px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
    padding: 0 26px; font-size: 13px; font-weight: 600; color: #1f2330; background: transparent; z-index: 20;
}
.sb-icons { display: inline-flex; align-items: center; gap: 5px; }
.sb-icons i { display: inline-block; background: #1f2330; border-radius: 2px; }
.sb-signal { width: 16px; height: 11px; -webkit-mask: linear-gradient(#000 0 0) left/4px 100% no-repeat, linear-gradient(#000 0 0) 6px/4px 100% no-repeat, linear-gradient(#000 0 0) 12px/4px 100% no-repeat; }
.sb-wifi { width: 15px; height: 11px; border-radius: 0 0 8px 8px; }
.sb-battery { width: 22px; height: 11px; border-radius: 3px; position: relative; }
.sb-battery::after { content:""; position:absolute; right:-3px; top:3px; width:2px; height:5px; background:#1f2330; border-radius:1px; }

/* ---------- 屏幕 ---------- */
.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; z-index: 10; }

/* 顶栏（各模块动态渲染） */
.app-header {
    flex-shrink: 0; min-height: 50px; display: flex; align-items: center; gap: 10px;
    padding: 6px 14px; background: rgba(245,246,251,.86); backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,.05);
}
.app-header .h-title { font-size: 18px; font-weight: 800; letter-spacing: .5px; }
.app-header .h-title.grad {
    background: linear-gradient(135deg,#ff4d9d,#a855f7);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.app-header .h-spacer { flex: 1; }
.app-header .h-search {
    flex: 1; display: flex; align-items: center; gap: 6px; background: #eceef5;
    border-radius: 999px; padding: 7px 12px; color: #9aa0b5; font-size: 13px;
}
.app-header .h-btn {
    width: 34px; height: 34px; border-radius: 50%; border: none; background: #eceef5;
    font-size: 17px; color: #44495c; display: flex; align-items: center; justify-content: center;
}
.app-header .h-btn.primary { background: linear-gradient(135deg,#ff4d9d,#a855f7); color: #fff; box-shadow: 0 4px 12px rgba(255,77,157,.35); }

/* 内容滚动区 */
.app-content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; background: #f5f6fb; }

/* ---------- 底部 Tab ---------- */
.tabbar {
    flex-shrink: 0; height: 58px; display: flex; align-items: stretch;
    background: rgba(255,255,255,.94); backdrop-filter: blur(14px);
    border-top: 1px solid rgba(0,0,0,.06); position: relative; z-index: 20;
}
.tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: #9aa0b5; font-size: 11px; position: relative; transition: color .15s;
}
.tab .tab-ico { font-size: 21px; filter: grayscale(.3); transition: transform .15s; }
.tab.active { color: #ff4d9d; }
.tab.active .tab-ico { filter: none; transform: translateY(-1px) scale(1.06); }
.tab-badge {
    position: absolute; top: 6px; left: 56%; min-width: 16px; height: 16px; padding: 0 4px;
    background: #fb7185; color: #fff; font-size: 10px; line-height: 16px; text-align: center;
    border-radius: 999px; box-shadow: 0 0 0 2px #fff;
}

/* ---------- 通用：头像 ---------- */
.avatar {
    border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; overflow: hidden;
}

/* ---------- 通用：胶囊/标签 ---------- */
.chip {
    display: inline-flex; align-items: center; padding: 6px 14px; border-radius: 999px;
    font-size: 13px; color: #5b6175; background: #eceef5; border: 1px solid transparent; transition: all .15s;
}
.chip.active { color: #fff; background: linear-gradient(135deg,#ff4d9d,#a855f7); box-shadow: 0 4px 12px rgba(255,77,157,.3); }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 12px 14px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }

/* ---------- 首页 / 动态流 ---------- */
.story-row { display: flex; gap: 14px; padding: 12px 14px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid rgba(0,0,0,.04); }
.story-row::-webkit-scrollbar { display: none; }
.story { display: flex; flex-direction: column; align-items: center; gap: 5px; flex-shrink: 0; width: 60px; }
.story .s-ava { width: 56px; height: 56px; border-radius: 50%; padding: 2px; background: linear-gradient(135deg,#ff4d9d,#a855f7); }
.story .s-ava .avatar { width: 100%; height: 100%; border: 2px solid #fff; }
.story .s-txt { font-size: 11px; color: #5b6175; max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.post {
    background: #fff; border-radius: 16px; margin: 10px 12px; padding: 14px;
    box-shadow: 0 2px 12px rgba(20,18,40,.05);
}
.post-head { display: flex; align-items: center; gap: 10px; }
.post-head .ph-name { font-size: 14px; font-weight: 700; }
.post-head .ph-meta { font-size: 11px; color: #9aa0b5; }
.post-head .ph-follow {
    margin-left: auto; font-size: 12px; color: #ff4d9d; border: 1px solid #ff4d9d; background: transparent;
    border-radius: 999px; padding: 4px 12px;
}
.post-head .ph-follow.following { color: #9aa0b5; border-color: #e2e5ee; }
.post-content { font-size: 15px; line-height: 1.65; margin: 10px 0; color: #2a2e3c; }
.post-content .tag { color: #a855f7; font-weight: 600; }
.post-imgs { display: grid; gap: 4px; margin: 8px 0; border-radius: 12px; overflow: hidden; }
.post-imgs.n1 { grid-template-columns: 1fr; }
.post-imgs.n2 { grid-template-columns: 1fr 1fr; }
.post-imgs.n3 { grid-template-columns: repeat(3,1fr); }
.post-imgs.n4 { grid-template-columns: 1fr 1fr; }
.post-imgs .ph { aspect-ratio: 1/1; }
.post-imgs.n1 .ph { aspect-ratio: 4/3; }
.post-actions { display: flex; align-items: center; margin-top: 6px; border-top: 1px solid #f0f1f6; padding-top: 8px; }
.act {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    background: none; border: none; color: #8a8fa3; font-size: 13px; padding: 4px 0;
}
.act .a-ico { font-size: 16px; }
.act.liked { color: #fb7185; }
.act.collected { color: #fbbf24; }
.act:active { transform: scale(.92); }

/* ---------- 详情 / 聊天的全屏弹层 ---------- */
.sheet-mask {
    position: absolute; inset: 0; background: rgba(10,8,20,.45); z-index: 40;
    animation: fade .15s ease; display: flex; align-items: flex-end;
}
.sheet {
    width: 100%; height: 100%; background: #fff; display: flex; flex-direction: column;
    animation: sheetUp .22s ease;
}
.sheet-header {
    flex-shrink: 0; height: 50px; display: flex; align-items: center; gap: 8px; padding: 0 12px;
    border-bottom: 1px solid #f0f1f6; background: rgba(255,255,255,.95); backdrop-filter: blur(10px);
}
.sheet-back { width: 34px; height: 34px; border: none; background: none; font-size: 24px; color: #2a2e3c; }
.sheet-title { font-size: 16px; font-weight: 700; }
.sheet-header .h-spacer { flex: 1; }
.sheet-body { flex: 1; overflow-y: auto; background: #f5f6fb; }

@keyframes sheetUp { from { transform: translateY(8%); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 发现 ---------- */
.cover-card {
    position: relative; height: 110px; border-radius: 16px; overflow: hidden; margin: 0 12px 10px;
    display: flex; align-items: flex-end; padding: 12px; color: #fff;
}
.cover-card .cc-name { font-size: 17px; font-weight: 800; text-shadow: 0 1px 6px rgba(0,0,0,.4); }
.cover-card .cc-meta { position: absolute; top: 12px; right: 12px; font-size: 11px; background: rgba(0,0,0,.3); padding: 3px 8px; border-radius: 999px; }
.circle-card { background: #fff; border-radius: 14px; margin: 0 12px 10px; padding: 12px; display: flex; align-items: center; gap: 12px; box-shadow: 0 2px 10px rgba(20,18,40,.05); }
.circle-card .cc-ava { width: 50px; height: 50px; border-radius: 14px; flex-shrink: 0; }
.circle-card .cc-info { flex: 1; min-width: 0; }
.circle-card .cc-info .t { font-size: 15px; font-weight: 700; }
.circle-card .cc-info .d { font-size: 12px; color: #9aa0b5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.circle-card .cc-join { font-size: 12px; color: #fff; border: none; background: linear-gradient(135deg,#ff4d9d,#a855f7); border-radius: 999px; padding: 6px 14px; }
.circle-card .cc-join.joined { color: #9aa0b5; background: #eceef5; }

.topic-item { background: #fff; border-radius: 12px; margin: 0 12px 8px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; box-shadow: 0 1px 8px rgba(20,18,40,.04); }
.topic-item .ti-rank { width: 24px; font-size: 16px; font-weight: 800; color: #ff4d9d; }
.topic-item .ti-main { flex: 1; }
.topic-item .ti-main .ti-t { font-size: 15px; font-weight: 700; }
.topic-item .ti-main .ti-s { font-size: 12px; color: #9aa0b5; }
.topic-item .ti-fire { color: #fb7185; font-size: 13px; }

/* ---------- 消息 ---------- */
.seg { display: flex; gap: 18px; padding: 12px 14px 6px; }
.seg .sg { font-size: 15px; color: #9aa0b5; font-weight: 600; position: relative; padding-bottom: 6px; }
.seg .sg.active { color: #1f2330; }
.seg .sg.active::after { content:""; position:absolute; left:0; right:0; bottom:0; height:3px; border-radius:3px; background: linear-gradient(135deg,#ff4d9d,#a855f7); }
.conv { background: #fff; margin: 8px 12px; border-radius: 14px; padding: 12px; display: flex; align-items: center; gap: 12px; box-shadow: 0 1px 8px rgba(20,18,40,.04); }
.conv .conv-ava { position: relative; }
.conv-ava.group-ava { display: flex; align-items: center; }
.group-ava .avatar { width: 30px; height: 30px; border: 2px solid #fff; border-radius: 50%; font-size: 11px; }
.group-ava .avatar + .avatar { margin-left: -10px; }
.grp-emoji { position: absolute; right: -4px; bottom: -4px; font-size: 12px; background: #fff; border-radius: 50%; line-height: 1; }
.conv .conv-unread { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px; background: #fb7185; color: #fff; font-size: 10px; line-height: 16px; text-align: center; border-radius: 999px; box-shadow: 0 0 0 2px #fff; }
.conv .conv-main { flex: 1; min-width: 0; }
.conv .conv-main .t { font-size: 15px; font-weight: 700; }
.conv .conv-main .m { font-size: 13px; color: #9aa0b5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .conv-time { font-size: 11px; color: #b6bacb; }

.notify { background: #fff; margin: 8px 12px; border-radius: 14px; padding: 12px 14px; display: flex; gap: 10px; box-shadow: 0 1px 8px rgba(20,18,40,.04); }
.notify .nt-ico { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.notify .nt-main { flex: 1; }
.notify .nt-main .t { font-size: 14px; }
.notify .nt-main .s { font-size: 12px; color: #9aa0b5; margin-top: 2px; }
.notify.unread { box-shadow: 0 0 0 1px rgba(255,77,157,.4), 0 1px 8px rgba(20,18,40,.04); }

/* ---------- 聊天 ---------- */
.chat-body { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 10px; background: #f0f1f7; }
.bubble-row { display: flex; flex-direction: column; max-width: 74%; }
.bubble-row.me { align-self: flex-end; align-items: flex-end; }
.bubble-row.them { align-self: flex-start; align-items: flex-start; }
.b-name { font-size: 11px; color: #9aa0b5; margin: 0 4px 3px; }
.bubble { max-width: 100%; padding: 9px 13px; border-radius: 16px; font-size: 14px; line-height: 1.5; word-break: break-word; }
.bubble.them { background: #fff; border-bottom-left-radius: 4px; color: #2a2e3c; }
.bubble.me { background: linear-gradient(135deg,#ff4d9d,#a855f7); color: #fff; border-bottom-right-radius: 4px; }
.chat-input { flex-shrink: 0; display: flex; gap: 8px; padding: 10px 12px; background: #fff; border-top: 1px solid #f0f1f6; }
.chat-input input { flex: 1; border: 1px solid #e2e5ee; border-radius: 999px; padding: 9px 14px; font-size: 14px; outline: none; }
.chat-input input:focus { border-color: #a855f7; }
.chat-input button { border: none; background: linear-gradient(135deg,#ff4d9d,#a855f7); color: #fff; border-radius: 999px; padding: 0 18px; font-size: 14px; }
.chat-input .ci-emoji { border: none; background: #f0f1f7; border-radius: 50%; width: 34px; height: 34px; font-size: 18px; flex-shrink: 0; }
.emoji-panel { flex-shrink: 0; display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; background: #fff; border-top: 1px solid #f0f1f6; max-height: 150px; overflow-y: auto; }
.emoji-panel[hidden] { display: none; }
.emoji-i { font-size: 22px; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 8px; cursor: pointer; }
.emoji-i:active { background: #f0f1f7; }

/* ---------- 我的 ---------- */
.profile-hero { background: linear-gradient(135deg,#ff4d9d,#a855f7); padding: 20px 16px 26px; color: #fff; position: relative; }
.profile-hero .ph-top { display: flex; align-items: center; gap: 14px; }
.profile-hero .ph-top .avatar { width: 64px; height: 64px; border: 3px solid rgba(255,255,255,.6); font-size: 24px; }
.profile-hero .ph-name { font-size: 20px; font-weight: 800; }
.profile-hero .ph-bio { font-size: 13px; opacity: .9; margin-top: 4px; }
.profile-hero .ph-edit { position: absolute; top: 18px; right: 16px; font-size: 12px; background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.5); color: #fff; border-radius: 999px; padding: 5px 12px; }
.profile-stats { display: flex; background: #fff; margin: -16px 12px 0; border-radius: 14px; padding: 14px 0; box-shadow: 0 4px 16px rgba(20,18,40,.08); position: relative; }
.profile-stats .ps { flex: 1; text-align: center; }
.profile-stats .ps .n { font-size: 18px; font-weight: 800; }
.profile-stats .ps .l { font-size: 12px; color: #9aa0b5; }
.profile-stats .ps + .ps { border-left: 1px solid #f0f1f6; }

.my-tabs { display: flex; margin: 14px 12px 8px; background: #eceef5; border-radius: 12px; padding: 4px; }
.my-tabs .mt { flex: 1; text-align: center; padding: 8px 0; font-size: 13px; color: #5b6175; border-radius: 9px; }
.my-tabs .mt.active { background: #fff; color: #1f2330; font-weight: 700; box-shadow: 0 2px 8px rgba(20,18,40,.06); }

.my-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 12px; }
.my-cell { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 8px rgba(20,18,40,.04); }
.my-cell .mc-img { aspect-ratio: 1/1; }
.my-cell .mc-t { font-size: 12px; color: #2a2e3c; padding: 7px 9px; line-height: 1.4; max-height: 38px; overflow: hidden; }
.my-cell .mc-meta { font-size: 11px; color: #9aa0b5; padding: 0 9px 8px; }

.setting-group { margin: 14px 12px; background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 8px rgba(20,18,40,.04); }
.setting-item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; font-size: 14px; border-bottom: 1px solid #f0f1f6; }
.setting-item:last-child { border-bottom: none; }
.setting-item .si-ico { width: 26px; text-align: center; }
.setting-item .si-main { flex: 1; }
.setting-item .si-arrow { color: #c4c8d6; }

/* ---------- 发布弹层 ---------- */
.publish { padding: 14px; }
.publish textarea {
    width: 100%; min-height: 120px; border: none; resize: none; outline: none; font-size: 16px;
    line-height: 1.6; font-family: inherit; color: #2a2e3c; background: transparent;
}
.publish .pb-tools { display: flex; gap: 10px; margin-top: 10px; }
.publish .pb-tools .pb-tool { font-size: 22px; width: 44px; height: 44px; border-radius: 12px; background: #f0f1f7; display: flex; align-items: center; justify-content: center; }
.publish .pb-foot { display: flex; align-items: center; margin-top: 14px; }
.publish .pb-foot .spacer { flex: 1; }
.publish .pb-send { border: none; background: linear-gradient(135deg,#ff4d9d,#a855f7); color: #fff; border-radius: 999px; padding: 9px 22px; font-size: 14px; font-weight: 600; }
.pb-imgs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pb-img { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; }
.pb-img-bg { width: 100%; height: 100%; }
.pb-img-x { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.pb-add { background: #f0f1f7; display: flex; align-items: center; justify-content: center; font-size: 28px; color: #9aa0b5; cursor: pointer; }
.emoji-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.emoji-row .emoji-i { font-size: 20px; }

/* ---------- 评论 ---------- */
.comment { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid #f0f1f6; }
.comment .avatar { width: 36px; height: 36px; font-size: 14px; }
.comment .c-main { flex: 1; }
.comment .c-main .c-name { font-size: 13px; font-weight: 700; color: #44495c; }
.comment .c-main .c-text { font-size: 14px; color: #2a2e3c; margin-top: 2px; }
.comment .c-main .c-time { font-size: 11px; color: #b6bacb; margin-top: 3px; }
.comment-input { flex-shrink: 0; display: flex; gap: 8px; padding: 10px 12px; background: #fff; border-top: 1px solid #f0f1f6; }

/* ---------- Toast ---------- */
.toast {
    position: absolute; left: 50%; top: 70px; transform: translateX(-50%);
    background: rgba(20,18,38,.94); color: #fff; padding: 10px 18px; border-radius: 12px;
    font-size: 13px; z-index: 60; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: toastIn .2s ease;
    backdrop-filter: blur(10px); max-width: 80%;
}
.toast.success { background: linear-gradient(135deg,#10b981,#059669); }
.toast.error { background: linear-gradient(135deg,#fb7185,#e11d48); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%,-8px); } to { opacity: 1; transform: translate(-50%,0); } }

.loading { text-align: center; color: #9aa0b5; padding: 30px 0; font-size: 13px; }
.empty-tip { text-align: center; color: #9aa0b5; padding: 50px 0; font-size: 14px; }

/* ---------- 窄屏：铺满真机，隐藏设备外壳 ---------- */
@media (max-width: 480px) {
    body { padding: 0; background: #f5f6fb; }
    .device { padding: 0; background: #f5f6fb; border-radius: 0; box-shadow: none; }
    .phone { width: 100%; height: 100vh; max-height: none; max-width: none; border-radius: 0; box-shadow: none; }
    .notch { display: none; }
    .statusbar { display: none; }
}
