/* 枕边人666 - H5 样式 */
:root {
  --bg: #0d0d12;
  --bg2: #14141c;
  --card: #1b1b26;
  --card2: #22222f;
  --line: #2a2a38;
  --text: #ececf2;
  --text2: #9a9aad;
  --text3: #66667a;
  --accent: #ff4d6d;
  --accent2: #ff7a45;
  --grad: linear-gradient(135deg, #ff4d6d, #ff7a45);
  --radius: 14px;
  --tabbar-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px; max-width: 560px; margin: 0 auto;
  -webkit-font-smoothing: antialiased;
}
#app { min-height: 100vh; display: flex; flex-direction: column; }
#page { flex: 1; padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px); }
#page.no-tab { padding-bottom: 8px; }
a { color: inherit; text-decoration: none; }
img { display: block; }
.hidden { display: none !important; }

/* 顶栏 */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px; background: rgba(13,13,18,.92);
  backdrop-filter: blur(10px); }
.topbar .back { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--card); font-size: 18px; cursor: pointer; }
.topbar .title { font-size: 17px; font-weight: 600; flex: 1; text-align: center; }
.topbar .act { min-width: 32px; text-align: right; color: var(--accent); font-size: 14px; }

/* 品牌头 */
.brand-head { padding: calc(env(safe-area-inset-top,0px) + 18px) 16px 6px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; background: var(--grad); display: flex; align-items: center; justify-content: center; font-size: 15px; color: #fff; }
.brand .logo em { font-style: normal; }
.loc { color: var(--text2); font-size: 13px; display: flex; align-items: center; gap: 4px; cursor: pointer; }

/* 发现筛选 */
.filter-tabs { display: flex; gap: 18px; padding: 10px 16px 4px; }
.filter-tabs a { color: var(--text2); font-size: 15px; padding-bottom: 6px; position: relative; }
.filter-tabs a.on { color: var(--accent); font-weight: 600; }
.filter-tabs a.on::after { content: ""; position: absolute; left: 20%; right: 20%; bottom: 0; height: 3px; border-radius: 3px; background: var(--grad); }

/* 用户卡片 */
.user-card { display: flex; gap: 12px; margin: 10px 12px; padding: 12px; background: var(--card); border-radius: var(--radius); cursor: pointer; }
.user-card .avatar { width: 58px; height: 58px; border-radius: 14px; object-fit: cover; flex-shrink: 0; background: var(--card2); }
.user-card .mid { flex: 1; min-width: 0; }
.user-card .name-row { display: flex; align-items: center; gap: 6px; }
.user-card .name { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-vip { font-size: 10px; padding: 1px 5px; border-radius: 4px; background: linear-gradient(135deg,#f7b733,#fc4a1a); color: #fff; flex-shrink: 0; }
.tag-gender { font-size: 10px; padding: 1px 5px; border-radius: 4px; color: #fff; flex-shrink: 0; }
.tag-gender.f { background: #e6558c; } .tag-gender.m { background: #4d79ff; }
.user-card .meta { color: var(--text2); font-size: 12.5px; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card .bio { color: var(--text3); font-size: 12.5px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card .right { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; }
.user-card .dist { color: var(--accent2); font-size: 12.5px; }
.user-card .active { color: var(--text3); font-size: 11.5px; }

/* 空态/加载 */
.empty { text-align: center; color: var(--text3); padding: 60px 20px; }
.empty .icon { font-size: 42px; margin-bottom: 12px; }
.empty .btn { margin-top: 16px; }
.loading { text-align: center; color: var(--text3); padding: 20px; font-size: 13px; }
.end-tip { text-align: center; color: var(--text3); padding: 14px; font-size: 12px; }

/* 按钮 */
.btn { display: block; width: 100%; padding: 13px; border: none; border-radius: 12px; font-size: 16px; font-weight: 600;
  background: var(--grad); color: #fff; cursor: pointer; text-align: center; }
.btn:active { opacity: .85; }
.btn.plain { background: var(--card2); color: var(--text); }
.btn.small { width: auto; padding: 8px 18px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* 登录页 */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; padding: 0 28px; background: radial-gradient(ellipse at 20% -10%, rgba(255,77,109,.16), transparent 50%), var(--bg); }
.login-brand { margin-top: 14vh; text-align: center; }
.login-brand .logo { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 22px; background: var(--grad); display: flex; align-items: center; justify-content: center; font-size: 38px; color: #fff; }
.login-brand h1 { font-size: 24px; letter-spacing: 1px; }
.login-brand p { color: var(--text2); font-size: 13px; margin-top: 8px; }
.login-form { margin-top: 7vh; display: flex; flex-direction: column; gap: 14px; }
.input-row { display: flex; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; }
.input-row:focus-within { border-color: var(--accent); }
.input-row input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 15px; padding: 14px 0; }
.input-row input::placeholder { color: var(--text3); }
.input-row .code-btn { color: var(--accent); font-size: 13.5px; background: none; border: none; cursor: pointer; white-space: nowrap; padding-left: 10px; }
.login-switch { text-align: center; color: var(--text2); font-size: 13.5px; margin-top: 4px; cursor: pointer; }
.login-switch b { color: var(--accent); font-weight: 500; }
.agreement { color: var(--text3); font-size: 11.5px; text-align: center; margin-top: 14px; line-height: 1.6; }

/* 底部导航 */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px;
  display: flex; height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(16,16,22,.96); backdrop-filter: blur(12px); border-top: 1px solid var(--line); z-index: 30; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--text3); font-size: 11px; position: relative; }
.tabbar a.on { color: var(--accent); }
.tabbar .ticon { width: 23px; height: 23px; }
.tabbar .ticon svg { width: 100%; height: 100%; }
.tabbar .badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--accent); color: #fff; font-size: 10px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-style: normal; }

/* 动态 */
.moment-card { margin: 10px 12px; background: var(--card); border-radius: var(--radius); padding: 14px; }
.moment-head { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.moment-head img { width: 42px; height: 42px; border-radius: 12px; object-fit: cover; }
.moment-head .n { font-weight: 600; }
.moment-head .s { color: var(--text3); font-size: 12px; margin-top: 3px; }
.moment-text { margin-top: 10px; line-height: 1.55; font-size: 14.5px; word-break: break-word; }
.moment-imgs { display: grid; gap: 6px; margin-top: 10px; }
.moment-imgs.n1 { grid-template-columns: 70%; }
.moment-imgs.n3 { grid-template-columns: repeat(3, 1fr); }
.moment-imgs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.moment-foot { display: flex; gap: 22px; margin-top: 12px; color: var(--text2); font-size: 13px; }
.moment-foot span { cursor: pointer; display: flex; align-items: center; gap: 5px; }
.moment-foot span.liked { color: var(--accent); }
.publish-bar { position: absolute; right: 16px; }

/* 聊天列表 */
.conv-item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; cursor: pointer; }
.conv-item:active { background: var(--bg2); }
.conv-item img { width: 50px; height: 50px; border-radius: 14px; object-fit: cover; }
.conv-item .mid { flex: 1; min-width: 0; border-bottom: 1px solid var(--line); padding-bottom: 13px; }
.conv-item:last-child .mid { border-bottom: none; }
.conv-item .row1 { display: flex; justify-content: space-between; align-items: center; }
.conv-item .name { font-weight: 600; }
.conv-item .time { color: var(--text3); font-size: 11.5px; }
.conv-item .row2 { display: flex; justify-content: space-between; margin-top: 4px; }
.conv-item .preview { color: var(--text2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 75%; }
.conv-item .badge { background: var(--accent); color: #fff; font-size: 10px; min-width: 17px; height: 17px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-style: normal; padding: 0 5px; }

/* 聊天室 */
.chat-page { display: flex; flex-direction: column; height: 100vh; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 8px; max-width: 82%; }
.msg img.av { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; margin-top: auto; }
.msg .bubble { padding: 10px 13px; border-radius: 14px; line-height: 1.5; font-size: 14.5px; word-break: break-word; }
.msg.peer { align-self: flex-start; }
.msg.peer .bubble { background: var(--card2); border-top-left-radius: 4px; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg.mine .bubble { background: var(--grad); border-top-right-radius: 4px; }
.msg .bubble img { max-width: 180px; border-radius: 8px; }
.chat-input { display: flex; gap: 10px; padding: 10px 12px calc(10px + var(--safe-b)); background: var(--bg2); border-top: 1px solid var(--line); }
.chat-input input { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; color: var(--text); outline: none; font-size: 15px; }
.chat-input .send { width: auto; padding: 0 20px; border-radius: 12px; }
.chat-tip { text-align: center; font-size: 12px; color: var(--text3); background: var(--card); margin: 10px auto; padding: 8px 14px; border-radius: 20px; max-width: 85%; }

/* 资料页 */
.profile-hero { padding: 20px 16px; display: flex; gap: 14px; }
.profile-hero img { width: 84px; height: 84px; border-radius: 20px; object-fit: cover; }
.profile-hero .name { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.profile-hero .meta { color: var(--text2); font-size: 13px; margin-top: 6px; }
.profile-section { background: var(--card); margin: 10px 12px; border-radius: var(--radius); padding: 14px 16px; }
.profile-section h4 { font-size: 13px; color: var(--text2); font-weight: 500; margin-bottom: 8px; }
.profile-section .bio { line-height: 1.6; font-size: 14px; }
.info-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.info-grid .chip { background: var(--card2); border-radius: 8px; padding: 5px 10px; font-size: 12.5px; color: var(--text2); }
.profile-actions { display: flex; gap: 10px; padding: 14px 12px; }
.danger-link { color: #ff6b6b; }

/* 我的 */
.me-head { padding: calc(env(safe-area-inset-top,0px) + 24px) 16px 18px; display: flex; align-items: center; gap: 14px; }
.me-head img { width: 64px; height: 64px; border-radius: 18px; object-fit: cover; }
.me-head .name { font-size: 19px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.me-head .sub { color: var(--text2); font-size: 13px; margin-top: 5px; }
.me-stats { display: flex; background: var(--card); margin: 0 12px 10px; border-radius: var(--radius); padding: 14px 0; }
.me-stats a { flex: 1; text-align: center; }
.me-stats .v { font-size: 17px; font-weight: 700; }
.me-stats .k { color: var(--text2); font-size: 12px; margin-top: 3px; }
.menu { background: var(--card); margin: 10px 12px; border-radius: var(--radius); overflow: hidden; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; font-size: 14.5px; }
.menu-item:active { background: var(--card2); }
.menu-item .mi { width: 22px; text-align: center; }
.menu-item .arrow { margin-left: auto; color: var(--text3); }
.menu-item + .menu-item { border-top: 1px solid var(--line); }

/* 编辑资料 */
.form-block { background: var(--card); margin: 12px; border-radius: var(--radius); overflow: hidden; }
.form-row { display: flex; align-items: center; padding: 14px 16px; gap: 10px; }
.form-row + .form-row { border-top: 1px solid var(--line); }
.form-row label { width: 76px; color: var(--text2); font-size: 14px; flex-shrink: 0; }
.form-row input, .form-row textarea, .form-row select { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 15px; font-family: inherit; }
.form-row textarea { min-height: 70px; resize: none; line-height: 1.5; }
.form-row select { background: var(--card); }
.avatar-edit { display: flex; flex-direction: column; align-items: center; padding: 24px 0 10px; }
.avatar-edit img { width: 76px; height: 76px; border-radius: 20px; object-fit: cover; }
.avatar-edit span { color: var(--text2); font-size: 12px; margin-top: 8px; }

/* 设置 */
.list-block { background: var(--card); margin: 12px; border-radius: var(--radius); overflow: hidden; }

/* Toast & Modal */
.toast { position: fixed; left: 50%; bottom: 20%; transform: translateX(-50%); background: rgba(30,30,40,.95); color: #fff;
  padding: 10px 20px; border-radius: 12px; font-size: 14px; z-index: 99; max-width: 80%; text-align: center; }
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 30px; }
.modal { background: var(--card); border-radius: 16px; padding: 22px; width: 100%; max-width: 320px; }
.modal h3 { font-size: 17px; margin-bottom: 14px; text-align: center; }
.modal textarea { width: 100%; background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; color: var(--text); outline: none; font-family: inherit; font-size: 14px; min-height: 70px; }
.modal .btns { display: flex; gap: 10px; margin-top: 16px; }

/* 城市选择 */
.city-grid { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
.city-grid a { background: var(--card); padding: 9px 18px; border-radius: 10px; font-size: 14px; color: var(--text2); }
.city-grid a.on { background: var(--grad); color: #fff; font-weight: 600; }

/* 图片预览 */
.preview-mask { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 80; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.preview-mask img { max-width: 100%; max-height: 90vh; object-fit: contain; }

@keyframes spin { to { transform: rotate(360deg); } }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--text3); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
