* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #ededed;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== 顶栏 ===== */
.topbar {
  flex: 0 0 48px;
  background: #2e6be6;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
  z-index: 10;
}
.topbar-title { font-size: 16px; font-weight: bold; }
.topbar-service { font-size: 12px; color: rgba(255,255,255,.75); margin-left: 12px; cursor: pointer; }
.topbar-service:hover { color: #fff; text-decoration: underline; }
.search-box {
  height: 26px; width: 120px;
  border: none; border-radius: 13px;
  padding: 0 12px; font-size: 12px;
  outline: none; background: rgba(255,255,255,.92);
}
.search-btn {
  height: 26px; padding: 0 12px;
  border: none; border-radius: 13px;
  background: rgba(255,255,255,.25); color: #fff;
  font-size: 12px; cursor: pointer; margin-left: 6px;
}
.search-btn:hover { background: rgba(255,255,255,.4); }
.watermark {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 150; /* 压在消息/大图查看器(100)之上，遮罩(200)之下 */
  background-repeat: repeat;
}
.topbar-right { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.pic-count { opacity: .85; }
.day-select {
  height: 28px;
  border: none;
  border-radius: 4px;
  background: rgba(255,255,255,.2);
  color: #fff;
  font-size: 13px;
  padding: 0 6px;
  cursor: pointer;
  outline: none;
}
.day-select option { color: #333; background: #fff; }
.time-sep.day-header { font-weight: bold; color: #666; }
.expire-badge {
  background: rgba(232,62,48,.9);
  color: #fff;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.btn-logout {
  background: rgba(255,255,255,.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
}
.btn-logout:hover { background: rgba(255,255,255,.3); }

/* 账号名 + 下拉菜单 */
.user-menu { position: relative; }
.username-toggle {
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 4px;
  user-select: none;
}
.username-toggle:hover, .username-toggle.open { background: rgba(255,255,255,.2); }
.username-toggle::after { content: ' ▾'; font-size: 10px; opacity: .8; }
.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  min-width: 120px;
  padding: 6px 0;
  z-index: 100;
}
.user-dropdown a {
  display: block;
  padding: 9px 16px;
  color: #333;
  text-decoration: none;
  font-size: 13px;
}
.user-dropdown a:hover { background: #f2f5fb; color: #2e6be6; }

/* ===== 消息流 ===== */
.feed {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px 24px;
  scroll-behavior: smooth;
}

.msg-row {
  display: flex;
  align-items: flex-start;
  margin: 10px 0;
  padding: 0 8px;
}
.avatar {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e5453d;
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  user-select: none;
}
.bubble {
  background: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  max-width: min(680px, 72%);
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  position: relative;
}
.bubble .meta {
  font-size: 12px;
  color: #888;
  margin-bottom: 6px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.bubble .meta .pname { color: #2e6be6; }
.bubble img {
  display: block;
  max-width: 100%;
  max-height: 520px;
  border-radius: 4px;
  cursor: zoom-in;
}
.bubble video {
  display: block;
  max-width: 100%;
  max-height: 520px;
  border-radius: 4px;
  background: #000;
}

/* 时间分隔（居中灰字，QQ样式） */
.time-sep {
  text-align: center;
  font-size: 12px;
  color: #999;
  margin: 14px 0 6px;
  user-select: none;
}

.load-more-wrap { text-align: center; padding: 6px 0 14px; }
.btn-load-more {
  background: #fff;
  border: 1px solid #ddd;
  color: #2e6be6;
  border-radius: 16px;
  padding: 6px 20px;
  font-size: 13px;
  cursor: pointer;
}
.btn-load-more:hover { background: #f5f8ff; }

.empty-tip {
  text-align: center;
  color: #999;
  padding: 60px 0;
  font-size: 14px;
}

/* 新图提示 */
.new-tip {
  position: fixed;
  bottom: 18px;
  right: 18px;
  background: #2e6be6;
  color: #fff;
  border-radius: 18px;
  padding: 8px 18px;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  display: none;
  z-index: 20;
}

/* ===== 大图查看 ===== */
.viewer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  cursor: zoom-out;
}
.viewer img { max-width: 96vw; max-height: 96vh; border-radius: 4px; }

/* ===== 被踢下线遮罩 ===== */
.kick-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.kick-card {
  background: #fff;
  border-radius: 10px;
  padding: 28px 36px;
  text-align: center;
}
.kick-title { font-size: 17px; font-weight: bold; margin-bottom: 10px; color: #333; }
.kick-msg { font-size: 14px; color: #e5453d; margin-bottom: 20px; }
.kick-card button {
  background: #2e6be6;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 26px;
  font-size: 14px;
  cursor: pointer;
}

/* ===== 登录页 ===== */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2e6be6 0%, #6a9cf0 100%);
}
.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 36px 40px;
  width: 340px;
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
}
.login-title { font-size: 18px; font-weight: bold; color: #2e6be6; text-align: center; margin-bottom: 22px; white-space: nowrap; }
.login-service { font-size: 12px; color: #999; text-align: center; margin-top: -10px; margin-bottom: 18px; cursor: pointer; }
.login-service:hover { color: #2e6be6; }

/* ===== 微信二维码弹窗（登录页/主页顶栏共用） ===== */
.qr-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-panel {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  width: 320px;
  max-width: 86vw;
  box-shadow: 0 8px 30px rgba(0,0,0,.3);
}
.qr-panel img {
  display: block;
  width: 100%;
  border-radius: 8px;
}
.qr-tip {
  margin-top: 10px;
  font-size: 12px;
  color: #999;
  text-align: center;
}
.login-card input {
  width: 100%;
  height: 40px;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0 12px;
  font-size: 14px;
  margin-bottom: 14px;
  outline: none;
}
.login-card input:focus { border-color: #2e6be6; }
.login-card button {
  width: 100%;
  height: 40px;
  background: #2e6be6;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
}
.login-card button:hover { background: #255cc9; }
.login-card button:disabled { background: #9db8ee; cursor: not-allowed; }
.err-msg { color: #e5453d; font-size: 13px; min-height: 18px; margin-bottom: 8px; text-align: center; }

/* ===== 搜索结果上下文弹窗 ===== */
#ctxMask {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 90; /* 大图查看器(100)之上、水印(150)之下——弹窗内看大图正常弹出，水印照样覆盖 */
  align-items: center; justify-content: center;
}
.ctx-panel {
  background: #fff; border-radius: 12px; width: 620px; max-width: 94vw; height: 84vh;
  display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,.25); overflow: hidden;
}
.ctx-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px; border-bottom: 1px solid #eee; flex-shrink: 0;
}
.ctx-head span { font-size: 14px; font-weight: bold; color: #333; }
.ctx-close {
  border: none; background: #f0f0f0; border-radius: 50%; width: 26px; height: 26px;
  cursor: pointer; font-size: 14px; color: #666;
}
.ctx-load {
  border: none; background: #f0f6ff; color: #2e6be6; padding: 9px;
  font-size: 12px; cursor: pointer; flex-shrink: 0;
}
.ctx-load:hover { background: #e3eefc; }
.ctx-load[disabled] { color: #bbb; cursor: default; background: #f7f7f7; }
#ctxFeed { flex: 1; overflow-y: auto; padding: 14px 16px; }
/* 命中条高亮：整行外框 + 浅蓝底（弹窗内图片为立即加载，整行框不会错位） */
#ctxFeed .msg-row.search-anchor {
  background: #e8f1fd;
  border: 2px solid #2e6be6;
  border-radius: 12px;
  padding: 6px 8px;
}
