/* style.css —— 基础样式（微信浅色风） */

:root {
  /* 底 */
  --bg: #ededed;
  --bg2: #ededed;
  --bg3: #ffffff;
  --bg-dim: #f5f5f5;
  /* 文字 */
  --fg: #191919;
  --fg2: #999999;
  --fg3: #b2b2b2;
  --on-accent: #ffffff;
  /* 线 */
  --line: #e5e5e5;
  --line2: #ededed;
  /* 强调 */
  --accent: #07c160;
  --accent-soft: #e7f7ee;
  --accent-dark: #06ad56;
  --link: #576b95;
  /* 状态 */
  --ok: #07c160;
  --err: #fa5151;
  --warn: #ffb64d;
  /* 气泡 */
  --bubble-me: #95ec69;
  --bubble-other: #ffffff;
  --bubble-me-fg: #191919;
  --bubble-other-fg: #191919;
  /* 浮层与阴影 */
  --overlay: #4c4c4c;
  --overlay-fg: #f2f2f2;
  --mask: rgba(0, 0, 0, .45);
  --shadow: rgba(0, 0, 0, .06);
  /* 杂 */
  --skeleton: #c8c8c8;
  --preview-bg: #e6e6e6;
  --quote-bg: rgba(0, 0, 0, .05);

  --bg: #ededed;        /* 页面背景 */
  --bg2: #ededed;       /* 标题栏 */
  --bg3: #ffffff;       /* 卡片/输入框 */
  --fg: #191919;        /* 主文字 */
  --fg2: #999999;       /* 次要文字 */
  --line: #e5e5e5;      /* 分隔线 */
  --line2: #d6d6d6;     /* 标题栏底线 */
  --accent: #07c160;    /* 微信绿（主题可改） */
  --accent-soft: #e7f7ee; /* 主题的浅底 */
  --ok: #07c160;
  --err: #fa5151;
  --bubble-me: #95ec69; /* 自己的气泡 */
  /* 聊天文字外观（设置页会改这几个） */
  --chat-font: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --chat-size: 16px;
  --chat-weight: 400;
  --chat-line: 1.5;
  --bubble-other: #ffffff;
}

* { box-sizing: border-box; }

/* 全局保住 hidden 属性。
   不写这条的话，任何带 display:flex/block 的元素被设 hidden 都不生效——
   登录页、搜索框、表情面板都会「关不掉」。 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: var(--fg);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 16px;
  cursor: pointer;
}
button:hover { background: var(--bg2); }
button.icon {
  padding: 4px 10px;
  font-size: 17px;
  line-height: 1.2;
  background: transparent;
  border: none;
  color: var(--fg);
}

input, select, textarea {
  font: inherit;
  color: var(--fg);
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 9px 10px;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 80px; }

/* ── 登录 ── */
/* 不能直接写 #login { display:flex }，那会盖掉 hidden 属性 */
#login {
  align-items: center;
  justify-content: center;
  height: 100%;
}
#login:not([hidden]) {
  display: flex;
}
#loginForm {
  width: 280px;
  text-align: center;
}
#loginForm h1 {
  font-size: 17px;
  font-weight: 500;
  margin: 0 0 20px;
  color: var(--fg2);
}
#loginForm input { margin-bottom: 12px; text-align: center; }
#loginForm button {
  width: 100%;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  font-weight: 500;
}
.err { color: var(--err); font-size: 14px; min-height: 20px; margin: 8px 0 0; }

/* ── 布局 ── */
/* 整页容器必须撑满，否则里面的 height:100% 会塌成 0 */
#app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

#chatView {
  height: 100%;
}

#subView {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ── 四个 tab ── */
.tab-pages {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.tab-page {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  border-bottom: 1px solid var(--line2);
  background: var(--bg2);
  font-size: 17px;
  font-weight: 500;
  position: sticky;
  top: 0;
  z-index: 3;
}
.page-head .head-right {
  position: absolute;
  right: 6px;
  font-size: 20px;
  color: var(--fg);
}

/* ── 朋友圈（微信风） ── */

/* 封面 */
.moments-cover {
  /* 宽度收窄并居中：全屏宽度太宽，16:9 的图会被裁掉大截 */
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  /* 高度跟着宽度走，宽屏时封顶 */
  aspect-ratio: 16 / 9;
  max-height: 320px;
  background-color: #3c4a5a;
  background-image: linear-gradient(160deg, #3c4a5a 0%, #5d6f82 55%, #8a9bab 100%);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  border-radius: 0 0 4px 4px;
}
.cover-me {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 14px 0;
}
.cover-name {
  font-size: 17px;
  color: var(--on-accent);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
}
.cover-avatar {
  width: 62px;
  height: 62px;
  border-radius: 4px;
  background: var(--skeleton) center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-accent);
  font-size: 26px;
  border: 1px solid rgba(255, 255, 255, .35);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}

/* 朋友圈整块收窄居中，跟封面同宽 */
#momentList,
#userMomentList,
#pageMoments .empty-page,
#pageMoments .loading {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
}

.moment {
  display: flex;
  gap: 10px;
  padding: 16px 16px 10px;
  background: var(--bg3);
}

.moment-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 4px;
  background: var(--skeleton) center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-accent);
  font-size: 17px;
}

.moment-body { flex: 1; min-width: 0; }

.moment-name {
  font-size: 14px;
  color: var(--link);
  font-weight: 500;
  margin-bottom: 3px;
}

.moment-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 8px;
  font-family: var(--chat-font);
}

/* 九宫格图片 */
.moment-imgs {
  display: grid;
  gap: 4px;
  margin-bottom: 6px;
  max-width: 288px;
}
.moment-imgs.n1 { grid-template-columns: 1fr; }
/* 单图按原比例显示，别被上面那条 aspect-ratio: 1 裁成方的
   （竖图会被切掉头和脚，横图两头被切） */
.moment-imgs.n1 img {
  width: auto;
  height: auto;
  max-width: 220px;
  max-height: 280px;
  aspect-ratio: auto;
  object-fit: contain;
}
.moment-imgs.n2,
.moment-imgs.n4 { grid-template-columns: repeat(2, 1fr); }
.moment-imgs.n3,
.moment-imgs.n5,
.moment-imgs.n6,
.moment-imgs.n7,
.moment-imgs.n8,
.moment-imgs.n9 { grid-template-columns: repeat(3, 1fr); }

.moment-imgs img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
  cursor: zoom-in;
  background: var(--bg2);
  /* 只有「点一下放大」这一种交互，长按别弹系统的存图/复制菜单 */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.moment-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.moment-time {
  font-size: 14px;
  color: var(--fg3);
}

.moment-actions {
  display: flex;
  gap: 8px;
}

/* 赞 / 评论 / 删除，独立三个键 */
.moment-act {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--bg2);
  border: none;
  border-radius: 4px;
  color: var(--link);
  font-size: 14px;
  line-height: 1;
  padding: 6px 10px;
  cursor: pointer;
}
.moment-act:active { background: var(--bg2); }
.moment-act.liked {
  color: var(--err);
  background: #fdf0f0;
}
.moment-act.danger { color: var(--fg2); }
.moment-act .act-ico { font-size: 14px; }
.moment-act .act-txt { font-size: 12px; }

/* 点赞 / 评论合并灰块 */
.moment-panel {
  margin-top: 8px;
  padding: 7px 9px;
  background: var(--bg2);
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.65;
}
.moment-likes {
  color: var(--link);
}
.like-heart { color: var(--link); }
.moment-comments.with-line {
  border-top: 1px solid var(--line);
  margin-top: 5px;
  padding-top: 5px;
}
.moment-comment {
  color: var(--fg);
  word-break: break-word;
  border-radius: 4px;
  padding: 1px 2px;
  margin: 0 -2px;
}
/* 自己的评论：点一下能删 */
.moment-comment.mine {
  cursor: pointer;
}
.moment-comment.mine:active {
  background: var(--preview-bg);
}
.mc-name { color: var(--link); }

/* 评论输入条（底部弹出） */
.comment-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 8px;
  padding: 9px 10px;
  padding-bottom: calc(9px + env(safe-area-inset-bottom, 0px));
  background: var(--bg2);
  border-top: 1px solid var(--line);
  z-index: 9997;
  animation: commentUp .18s ease;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, .06);
}
@keyframes commentUp {
  from { transform: translateY(100%); }
  to { transform: none; }
}
.comment-bar input {
  flex: 1;
  background: var(--bg3);
  border: none;
  border-radius: 4px;
  padding: 9px 11px;
  font-size: 14px;
  color: var(--fg);
}
.comment-bar input:focus {
  outline: none;
  border: none;
  box-shadow: inset 0 0 0 1px var(--accent);
}
.comment-bar button {
  flex: 0 0 auto;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: 4px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 500;
}
.comment-bar button:disabled {
  background: #c9e9d6;
}

/* 发布面板 */
.compose {
  width: 100%;
  background: var(--bg3);
  border-radius: 8px 8px 0 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
  animation: sheetUp .2s ease;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
}
.compose-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
  font-weight: 500;
}
.compose-head .plain {
  background: transparent;
  border: none;
  font-size: 14px;
  color: var(--fg);
  padding: 4px 6px;
}
.compose-head .plain.primary {
  color: var(--on-accent);
  background: var(--accent);
  border-radius: 4px;
  padding: 5px 14px;
}
.compose textarea {
  border: none;
  border-radius: 0;
  min-height: 120px;
  padding: 14px;
  font-size: 17px;
  resize: none;
}
.compose textarea:focus { border: none; }
/* 三列固定：以前是 flex-wrap + 76px 定宽，390 的屏刚好一排塞 4 个，
   9 张就成了 4+4+1，看着不像九宫格 */
.compose-imgs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 14px;
}
.compose-imgs.n1 { grid-template-columns: 1fr; }
.compose-img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--bg-dim) center/cover no-repeat;
  position: relative;
}
.compose-imgs.n1 .compose-img { max-width: 150px; }
.compose-img button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,.65);
  color: var(--on-accent);
  border: none;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.compose-actions {
  padding: 12px 14px 16px;
}

/* 二级页面头 */
.sub-head {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 46px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line2);
  background: var(--bg2);
  flex: 0 0 auto;
}
.sub-head span {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 500;
}

/* ── 底部 tab 栏 ── */
.tab-bar {
  flex: 0 0 auto;
  display: flex;
  height: 56px;
  border-top: 1px solid var(--line2);
  background: var(--bg2);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab-bar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--fg2);
  padding: 0;
}
.tab-bar button:hover { background: transparent; }
.tab-bar .ti {
  font-size: 20px;
  line-height: 1;
}
.tab-bar .tl {
  font-size: 12px;
  line-height: 1.4;
}
.tab-bar button.active {
  color: var(--accent);
}

/* ── 空状态 ── */
.empty-page {
  padding: 90px 30px;
  text-align: center;
}
.ep-icon {
  font-size: 44px;
  margin: 0 0 14px;
  opacity: .35;
}
.ep-text {
  font-size: 14px;
  color: var(--fg2);
  margin: 0 0 8px;
}
.ep-hint {
  font-size: 14px;
  color: var(--fg3);
  margin: 0;
  line-height: 1.6;
}

.loading {
  padding: 40px;
  text-align: center;
  color: var(--fg3);
  font-size: 14px;
}

/* ── 朋友 ── */
.friend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  position: relative;
  background: var(--bg3);
}
.friend-item::after {
  content: "";
  position: absolute;
  left: 76px;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--line);
}
.friend-item:last-child::after { display: none; }
.friend-item:active { background: var(--bg2); }

/* ── 我的 ── */
.me-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 26px 20px;
  background: var(--bg3);
  border-bottom: 1px solid var(--line);
}
.me-avatar {
  width: 62px;
  height: 62px;
  border-radius: 4px;
  background: var(--skeleton) center/cover no-repeat;
  color: var(--on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  overflow: hidden;
}
.me-card {
  display: flex;
  align-items: center;
  gap: 16px;
}
.me-names {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.me-name-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.me-sign {
  font-size: 12px;
  color: var(--fg3);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 58vw;
}
.me-sex {
  display: inline-flex;
  align-items: center;
  margin-left: 2px;
}
.me-name {
  font-size: 20px;
  font-weight: 500;
}
/* 昵称下面那行账号，小号灰字，字体跟着全局走 */
.me-uid {
  font-size: 12px;
  line-height: 1.4;
  color: var(--fg3);
  margin-top: 3px;
  font-family: inherit;
  letter-spacing: 0.2px;
}
.me-list {
  background: var(--bg3);
}
.me-list button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  background: var(--bg3);
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  font-size: 17px;
  color: var(--fg);
}
.me-list button:hover { background: var(--bg-dim); }
.me-list .arrow { color: #c8c8c8; font-size: 17px; }
.me-foot {
  text-align: center;
  color: var(--fg3);
  font-size: 12px;
  margin-top: 30px;
}

/* 设置页布局（在 subView 里） */
.settings-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* 设置页：内容 + 底部一排 tab */
#subView .settings-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.settings-tabs {
  flex: 0 0 auto;
  display: flex;
  border-top: 1px solid var(--line2);
  background: var(--bg2);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.settings-tabs button {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 13px 0;
  font-size: 14px;
  color: var(--fg2);
  cursor: pointer;
}
.settings-tabs button.active {
  color: var(--accent);
  font-weight: 500;
}

/* 外观面板 */
.ap-pane {
  padding: 20px 18px 32px;
  background: var(--bg3);
  flex: 1;
}
.ap-title {
  font-size: 14px;
  color: var(--fg2);
  margin: 0 0 12px;
  font-weight: 500;
}
.ap-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  max-width: 520px;
}
.ap-row.ap-col {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.ap-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ap-label {
  font-size: 14px;
  color: var(--fg);
  flex: 0 0 auto;
}
.ap-value {
  font-size: 14px;
  color: var(--fg2);
}
.ap-row select {
  width: auto;
  min-width: 120px;
  flex: 0 0 auto;
}
.ap-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  padding: 0;
  background: transparent;
  border: none;
}
.ap-row input[type="range"]:focus {
  box-shadow: none;
}

.ap-preview {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg);
  border-radius: 8px;
  max-width: 520px;
}
.ap-preview-bubble {
  display: inline-block;
  background: var(--bubble-me, #95ec69);
  color: var(--bubble-me-fg, #191919);
  padding: 10px 13px;
  border-radius: 4px;
  font-family: var(--chat-font);
  font-size: var(--chat-size);
  font-weight: var(--chat-weight);
  line-height: var(--chat-line);
  max-width: 100%;
}

.ap-hint {
  font-size: 12px;
  color: var(--fg3);
  margin: 18px 0 0;
  line-height: 1.6;
}

/* ── 底部弹出菜单 ── */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 9998;
  display: flex;
  align-items: flex-end;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

.sheet {
  width: 100%;
  background: var(--bg2);
  border-radius: 8px 8px 0 0;
  padding: 8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  animation: sheetUp .2s ease;
}
@keyframes sheetUp { from { transform: translateY(100%) } to { transform: translateY(0) } }

.sheet-title {
  text-align: center;
  font-size: 14px;
  color: var(--fg2);
  padding: 10px 0 6px;
}

.sheet-item {
  width: 100%;
  display: block;
  background: var(--bg3);
  border: none;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 6px;
  font-size: 17px;
  color: var(--fg);
  text-align: center;
}
.sheet-item:hover { background: var(--bg2); }
.sheet-item.danger { color: var(--err); }
.sheet-cancel { margin-top: 8px; margin-bottom: 0; font-weight: 500; }

header {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line2);
  background: var(--bg2);
  position: relative;
}
header span {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 500;
}
header .icon { color: var(--fg); }

.layout {
  display: flex;
  height: calc(100% - 46px);
}

aside {
  width: 200px;
  flex: 0 0 200px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  background: var(--bg2);
}

.plugin-item {
  padding: 13px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  font-size: 14px;
}
.plugin-item:hover { background: var(--bg2); }
.plugin-item.active {
  border-left-color: var(--accent);
  background: var(--bg3);
}

main {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  background: var(--bg3);
}

/* ── 设置表单 ── */
.pane-title {
  font-size: 17px;
  font-weight: 500;
  margin: 0 0 4px;
}
.pane-desc {
  color: var(--fg2);
  font-size: 14px;
  margin: 0 0 24px;
}

.field {
  margin-bottom: 20px;
  max-width: 520px;
}
.field-label {
  display: block;
  font-size: 14px;
  margin-bottom: 6px;
}
.field-hint {
  color: var(--fg2);
  font-size: 12px;
  margin-top: 4px;
}

/* 开关 */
.switch {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.switch input { display: none; }
.switch .track {
  width: 44px;
  height: 24px;
  background: var(--line);
  border-radius: 999px;
  position: relative;
  transition: background .15s;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg3);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .15s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(20px); }

/* 时段 */
.hours-row { display: flex; align-items: center; gap: 8px; }
.hours-row input { width: 80px; }

/* 列表 */
.list-row { display: flex; gap: 8px; margin-bottom: 8px; }
.list-row input { flex: 1; }
.list-row button { padding: 8px 12px; }

/* 保存条：固定在表单底部，滚不滚都看得见 */
.save-bar {
  position: sticky;
  bottom: 0;
  margin-top: 28px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  background: var(--bg3);
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 5;
}
.save-bar button {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  font-weight: 500;
  padding: 10px 28px;
  font-size: 14px;
}
.save-bar button:hover { background: #06ad56; }
.save-bar button:disabled { background: var(--line); color: #f2f2f2; }
.save-msg { font-size: 14px; color: var(--ok); }
.save-msg.bad { color: var(--err); }

.empty { color: var(--fg2); }

/* ── 裁剪界面 ── */
.crop-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .82);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.crop-wrap {
  width: min(560px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: #1b1d21;
  border-radius: 8px;
  overflow: hidden;
}
.crop-head {
  padding: 13px 16px;
  color: var(--fg3);
  font-size: 14px;
  text-align: center;
  border-bottom: 1px solid #303338;
}
.crop-stage {
  position: relative;
  flex: 1;
  min-height: 260px;
  max-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
  background: #111;
}
.crop-stage img {
  max-width: 100%;
  max-height: 60vh;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
/* 暗色遮罩，中间挖洞 */
.crop-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.crop-box {
  position: absolute;
  border: 2px solid #fff;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55);
  cursor: move;
  pointer-events: auto;
  touch-action: none;
  box-sizing: border-box;
}
.crop-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--bg3);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}
.crop-dot.tl { left: -7px; top: -7px; }
.crop-dot.tr { right: -7px; top: -7px; }
.crop-dot.bl { left: -7px; bottom: -7px; }
.crop-dot.br { right: -7px; bottom: -7px; cursor: nwse-resize; }
.crop-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid #303338;
}
.crop-actions .plain {
  flex: 1;
  background: #2d3036;
  border: none;
  color: var(--fg3);
  border-radius: 4px;
  padding: 10px;
  font-size: 14px;
  cursor: pointer;
}
.crop-actions .plain.primary {
  background: var(--accent);
  color: var(--on-accent);
}
.crop-actions .plain:active { opacity: .8; }

/* ── 文本输入弹窗 ── */
.input-sheet {
  width: 100%;
  background: var(--bg2);
  border-radius: 8px 8px 0 0;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  animation: sheetUp .2s ease;
}
.input-sheet-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  text-align: center;
  margin-bottom: 12px;
}
.input-sheet-field {
  width: 100%;
  background: var(--bg3);
  border: none;
  border-radius: 4px;
  padding: 11px 12px;
  font-size: 17px;
  color: var(--fg);
  resize: none;
  min-height: 46px;
  line-height: 1.4;
}
.input-sheet-field:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--accent);
}
.input-sheet-hint {
  font-size: 12px;
  color: var(--fg2);
  margin: 8px 2px 0;
  min-height: 16px;
  line-height: 1.5;
}
.input-sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.input-sheet-actions .plain {
  flex: 1;
  background: var(--bg3);
  border: none;
  border-radius: 4px;
  padding: 11px;
  font-size: 14px;
  color: var(--fg);
  cursor: pointer;
}
.input-sheet-actions .plain.primary {
  background: var(--accent);
  color: var(--on-accent);
}
.input-sheet-actions .plain:active { opacity: .85; }

/* ── 轻提示 ── */
#toastBox {
  position: fixed;
  left: 50%;
  bottom: 68px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  background: rgba(0, 0, 0, .78);
  color: var(--on-accent);
  padding: 9px 20px;
  border-radius: 4px;
  font-size: 14px;
  max-width: 80vw;
  text-align: center;
  animation: toastIn .18s ease;
}
.toast.bad { background: rgba(250, 81, 81, .92); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  aside { width: 140px; flex: 0 0 140px; }
  main { padding: 16px; }
  .field { max-width: none; }
}

/* ── 我的页右侧箭头 + 个人资料页 ── */
.me-more {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: #c8c8c8;
  font-size: 20px;
  line-height: 1;
  padding: 10px 0 10px 12px;
  cursor: pointer;
}
.profile-list { background: var(--bg3); }
.profile-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.profile-row:last-child { border-bottom: 0; }
.pr-label { flex: 0 0 auto; font-size: 14px; color: var(--fg); }
.pr-value {
  margin-left: auto;
  font-size: 14px;
  color: var(--fg2);
  max-width: 56vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}
.pr-value.pr-plain { color: #6a6a6a; }
.pr-arrow { color: #c8c8c8; font-size: 17px; }
.pr-av {
  display: inline-block;
  width: 42px;
  height: 42px;
  border-radius: 4px;
  background: var(--skeleton) center/cover no-repeat;
  color: var(--on-accent);
  font-size: 17px;
  text-align: center;
  line-height: 42px;
}

/* 全屏看大图 */
.zoom-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3100;
  cursor: zoom-out;
  /* 整页缩放是关掉的，这里把手势全接过来，图片自己缩自己 */
  touch-action: none;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.zoom-mask img {
  max-width: 86vw;
  max-height: 82vh;
  border-radius: 4px;
  transform-origin: center center;
  will-change: transform;
  touch-action: none;
  -webkit-user-drag: none;
}

/* 页头右边的按钮（加好友用） */
.page-head .head-right {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0 10px;
  line-height: 1;
  font-size: 20px;
  font-weight: 400;
  color: var(--fg);
}

/* 底部 tab 上的红点 / 角标 */
.tab-bar button { position: relative; }
.tab-badge {
  position: absolute;
  top: 2px;
  left: 50%;
  margin-left: 6px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 8px;
  background: #fa5151;
  color: var(--on-accent);
  font-size: 12px;
  line-height: 17px;
  text-align: center;
  box-sizing: border-box;
  font-weight: 400;
}
.tab-badge.dot {
  min-width: 9px;
  width: 9px;
  height: 9px;
  padding: 0;
  margin-left: 8px;
  top: 6px;
  font-size: 0;
}

/* 线条图标：跟文字同色，选中变绿 */
.tab-bar .ti svg,
.icon svg {
  width: 24px;
  height: 24px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab-bar .ti {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 24px;
}

/* 加号面板里的线条图标（之前没约束，SVG 按 300x150 黑块撑开了） */
.plus-panel .pi svg {
  width: 26px;
  height: 26px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.plus-panel .pi {
  color: #4a4a4a;
  font-size: 0;
}

/* ── 深色下还要单独压的几处（剩下靠变量）── */
/* 加号面板的图标颜色跟着走 */
.plus-panel .pi { color: var(--fg); }

/* 页头图标统一尺寸（个人资料的 ⋯ 也走这条） */
.sub-head .icon svg {
  width: 21px;
  height: 21px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sub-head .icon { line-height: 0; }

/* 聊天节奏设置 */
.rhythm-card {
  background: var(--bg3);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 12px 0;
  border: 1px solid var(--line);
}
.rhythm-name { font-size: 14px; font-weight: 500; margin-bottom: 10px; color: var(--fg); }
.rhythm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  font-size: 14px;
  color: var(--fg2);
}
.rhythm-row input {
  width: 90px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg2);
  color: var(--fg);
  font-size: 14px;
  text-align: right;
}
