/* ==========================================================================
   HideTalk · 视觉语言（v2 · 柔和填充）
   --------------------------------------------------------------------------
   一句话规则：**分层靠底色深浅，不靠描边**。
   - 控件（按钮 / 输入框 / 标签）一律无描边，用 --panel-2 / --panel-3 两级填充拉开层次；
   - 卡片、弹窗用更大圆角的整块填充面，结构线只保留极少数必要的一条（顶栏 / 输入区 / 分栏），
     且压到 --line（5.5% 白）几乎看不见；
   - 选中态 = 提亮一档填充 + 文字转亮，**不再画边框、不再加竖线**；
   - 圆角全站只有 4 档：10 / 14 / 20 / 26，外加胶囊 999。
   ========================================================================== */

:root {
  color-scheme: dark;
  /* 底色三层：0 页面 / 1 卡片 / 2 控件 / 3 选中。默认是黑夜。 */
  --bg: #0B0B0E;
  --bg-out: #070708;      /* 桌面外壳（卡片之外）的底色 */
  --panel: #1E202A;
  --panel-2: #2A2C38;
  --panel-3: #3A3D4C;   /* 选中态比控件再亮一档，夜间也能分开 */

  /* 分隔线：只给顶栏 / 输入区 / 分栏这类「必须切开」的地方用 */
  --line: rgba(255, 255, 255, .12);
  --line-2: rgba(255, 255, 255, .18);

  --fg: #E8E9EE;
  --fg-2: #C4C6D0;
  --fg-3: #A0A3AE;

  --ok: #5DCAA5;
  --warn: #EF9F27;
  --bad: #F09595;

  /* 主按钮和自己的气泡：黑夜里用抬高的灰，不用大块白。 */
  --solid: #4E5162;
  --solid-fg: #F4F5F7;
  --solid-hover: #5C6074;
  --bubble-me: var(--solid);
  --bubble-me-fg: var(--solid-fg);
  --bubble-them: var(--panel-2);
  --bubble-them-fg: var(--fg);

  --scroll: rgba(255, 255, 255, .14);
  --scroll-hover: rgba(255, 255, 255, .24);
  --mask: rgba(5, 5, 6, .74);
  --pulse: rgba(237, 237, 240, .12);
  --pulse-ring: rgba(237, 237, 240, .10);
  --ring: rgba(237, 237, 240, .16);
  --wash: rgba(255, 255, 255, .035);
  --track: rgba(255, 255, 255, .06);
  --shadow: 0 24px 64px rgba(0, 0, 0, .65);
  --shadow-sm: 0 10px 30px rgba(0, 0, 0, .45);
  --shadow-card: 0 30px 80px rgba(0, 0, 0, .55);
  --shadow-pop: 0 24px 60px rgba(0, 0, 0, .6);
  --shadow-toast: 0 18px 48px rgba(0, 0, 0, .55);
  --danger-bg: rgba(240, 149, 149, .12);
  --danger-bg-hover: rgba(240, 149, 149, .2);
  --toast-bad-bg: rgba(240, 149, 149, .14);
  --warn-bg: rgba(239, 159, 39, .10);
  --bad-bg: rgba(240, 149, 149, .10);

  /* 圆角四档 + 胶囊，别再发明新值 */
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --r-full: 999px;

  /* 字号阶梯：全站只允许这几档正文级 + hero/数字两个展示档 */
  --fs-xs: 11px;     /* 标签、徽标 */
  --fs-sm: 12px;     /* 辅助信息、次要说明 */
  --fs-md: 13px;     /* 次要正文、次级按钮 */
  --fs-base: 14px;   /* 正文、主按钮 */
  --fs-msg: 16px;    /* 1v1 / 聊天室气泡与输入（手机上 14 偏小） */
  --fs-lg: 20px;     /* 页面/弹窗标题 */

  /* 控件高度：主 42 / 次 34 / 小 28，别再发明新高度 */
  --h-ctl: 42px;
  --h-ctl-sm: 34px;
  --h-ctl-xs: 28px;

  /* 页面左右留白：顶栏、四个分区、弹窗横向都用这一档 */
  --inset: 20px;
}

/* 白天：浅底深字。结构、圆角、字号沿用上面，只换颜色。 */
html[data-theme="day"] {
  color-scheme: light;
  --bg: #F4F4F6;
  --bg-out: #E4E4E8;
  --panel: #FFFFFF;
  --panel-2: #E8E8ED;
  --panel-3: #D7D7DE;
  --line: rgba(16, 16, 20, .10);
  --line-2: rgba(16, 16, 20, .16);
  --fg: #141418;
  --fg-2: #3C3E46;
  --fg-3: #5C5E68;
  --ok: #0E7A52;
  --warn: #8A5600;
  --bad: #C43434;
  --solid: #17171B;
  --solid-fg: #FFFFFF;
  --solid-hover: #2E2E36;
  /* 白天：自己的气泡是深底亮字，跟主按钮同一套。 */
  --bubble-me: var(--solid);
  --bubble-me-fg: var(--solid-fg);
  --bubble-them: var(--panel-2);
  --bubble-them-fg: var(--fg);
  --scroll: rgba(16, 16, 20, .22);
  --scroll-hover: rgba(16, 16, 20, .34);
  --mask: rgba(20, 20, 24, .42);
  --pulse: rgba(20, 20, 24, .10);
  --pulse-ring: rgba(20, 20, 24, .08);
  --ring: rgba(20, 20, 24, .16);
  --wash: rgba(16, 16, 20, .045);
  --track: rgba(16, 16, 20, .08);
  --shadow: 0 18px 48px rgba(16, 16, 20, .16);
  --shadow-sm: 0 8px 24px rgba(16, 16, 20, .12);
  --shadow-card: 0 24px 60px rgba(16, 16, 20, .14);
  --shadow-pop: 0 18px 48px rgba(16, 16, 20, .16);
  --shadow-toast: 0 12px 32px rgba(16, 16, 20, .14);
  --danger-bg: rgba(196, 52, 52, .10);
  --danger-bg-hover: rgba(196, 52, 52, .16);
  --toast-bad-bg: rgba(196, 52, 52, .12);
  --warn-bg: rgba(138, 86, 0, .10);
  --bad-bg: rgba(196, 52, 52, .10);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  /* pan-y：只留上下滑。双击放大和双指缩放都不交给浏览器。 */
  touch-action: pan-y;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* 顶栏 / 底栏钉在外壳里，手指只滚动中间内容，整页不跟手弹 */
  position: fixed;
  inset: 0;
  width: 100%;
}

/* 用户端不走系统长按选字。-webkit-touch-callout 不继承，所以落到所有子元素。
   输入框仍可选中，方便改自己打的字。 */
body.shell,
body.shell * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
body.shell input,
body.shell textarea,
body.shell [contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; }
a { color: inherit; }

/* ---------- 滚动条：藏起来，滚动本身还在（滚轮、触控板、触摸、键盘） ---------- */
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 var(--inset);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- 顶栏 ---------- */

.bar {
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 0;
  position: relative;
  z-index: 6;
  background: var(--bg);
  touch-action: manipulation;
}

/* 系统把状态栏叠进网页时，顶栏和全屏层让出刘海。inset 为 0 时高度不变。 */
html.in-app .bar {
  height: calc(56px + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
}
html.in-app .modal {
  padding-top: calc(24px + env(safe-area-inset-top, 0px));
}
html.in-app .imgview {
  padding-top: calc(24px + env(safe-area-inset-top, 0px));
}
html.in-app .imgview-x {
  top: calc(16px + env(safe-area-inset-top, 0px));
}

.brand {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .04em;
}

.dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ok);
  margin-left: 7px;
  vertical-align: 2px;
}

.meta { font-size: 12px; color: var(--fg-3); }
.meta b { color: var(--fg-2); font-weight: 400; }

/* 顶栏里的在线人数：紧贴品牌，只报数不抢视线（不再用竖线分隔） */
.bar .online {
  flex: none;
  margin-left: 12px;
  margin-right: auto;
  font-size: var(--fs-xs);
  line-height: 1;
  color: var(--fg-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.bar .online[hidden] { display: none; }

/* ---------- 视图切换 ----------
   底栏四个分区左右滑：去右边的页，旧页向左出、新页从右进；反过来同理。
   只用 transform，底栏在 .stage 外面，滑的时候不动。首次进入不加 slide 类。 */

.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  position: relative;
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: pan-y;
  /* 滑的时候页面要能穿过左右页边距，裁切边改到应用卡片两侧。
     停稳后的内容仍由 .view 的内边距对齐顶栏。 */
  margin-left: calc(var(--inset) * -1);
  margin-right: calc(var(--inset) * -1);
}
.view {
  display: none;
  flex: 1;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  position: relative;
  touch-action: pan-y;
  padding-left: var(--inset);
  padding-right: var(--inset);
}
.view.on { display: flex; }

.stage.sliding > .view.slide-out,
.stage.sliding > .view.slide-in {
  display: flex;
  position: absolute;
  inset: 0;
  background: var(--bg);
}
.stage.dragging > .view.drag-on {
  display: flex;
  position: absolute;
  inset: 0;
  background: var(--bg);
  z-index: 2;
  transition: none;
  will-change: transform;
}
.stage.dragging.settling > .view.drag-on {
  transition: transform 260ms cubic-bezier(0.22, 1, 0.32, 1);
}
.view.slide-in { z-index: 2; }
.view.slide-out { z-index: 1; pointer-events: none; }
.view.slide-in.from-right { animation: view-in-right 240ms cubic-bezier(0.22, 1, 0.32, 1) both; }
.view.slide-in.from-left { animation: view-in-left 240ms cubic-bezier(0.22, 1, 0.32, 1) both; }
.view.slide-out.to-left { animation: view-out-left 240ms cubic-bezier(0.22, 1, 0.32, 1) both; }
.view.slide-out.to-right { animation: view-out-right 240ms cubic-bezier(0.22, 1, 0.32, 1) both; }

@keyframes view-in-right {
  from { transform: translate3d(100%, 0, 0); }
  to { transform: translate3d(0, 0, 0); }
}
@keyframes view-out-left {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-100%, 0, 0); }
}
@keyframes view-in-left {
  from { transform: translate3d(-100%, 0, 0); }
  to { transform: translate3d(0, 0, 0); }
}
@keyframes view-out-right {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(100%, 0, 0); }
}
@keyframes view-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes view-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* 首页在矮屏（横屏手机、小窗口）上允许滚动，别把底部 CTA 顶出可视区 */
[data-view="home"] { overflow-y: auto; }

/* ---------- 首页 ---------- */

/* 空间分配：整块内容垂直居中（上下 auto margin 平分剩余空间，矮屏时自动退化成正常流，
   不会像 justify-content:center 那样把标题顶出可视区）。顺序是
   标题 → 两行说明 → 偏好 → 主 CTA。 */
.hero {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 0 10px;
}

.hero-top {
  width: 100%;
  max-width: 400px;
  margin-top: auto;
}

.hero h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -.015em;
  line-height: 1.32;
}

/* 标题块按最长一行收窄并居中，说明文字才能和标题左缘对齐，Say Hi 仍居中 */
.hero-copy {
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  text-align: center;
}

.prefblock {
  width: 100%;
  max-width: 400px;
}
.home-show {
  margin: 12px 0 0;
  text-align: left;
}
.home-show[hidden] { display: none; }

/* 下段：偏好选择紧随主 CTA，两者一起构成「开始」这一步 */
.hero-bottom {
  width: 100%;
  max-width: 400px;
  margin-top: 28px;
  margin-bottom: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.hero-bottom .prefblock {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.hero-bottom .home-show {
  margin: 0;
}

.pointline {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: var(--fs-sm);
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}

.pointline[hidden] { display: none; }

.pointline .link { margin: 0; font-size: var(--fs-sm); }

.start {
  width: 100%;
  max-width: 400px;
  height: 46px;
  font-size: 15px;
}

/* ---------- 资料页 ---------- */

/* 展示开关：一整块填充面，行与行靠间距分开，不再画内部分隔线 */
.setgroup {
  margin: 4px 0 22px;
  padding: 6px;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--panel);
  overflow: hidden;
}

.setgroup-h {
  padding: 8px 10px 6px;
  font-size: var(--fs-base);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--fg);
}

.setrow {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: var(--r);
}

.setlabel {
  font-size: var(--fs-base);
  color: var(--fg);
  flex: none;
}

.setval {
  margin-left: auto;
  font-size: var(--fs-sm);
  color: var(--fg-3);
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setval.is-empty { color: var(--fg-3); }

/* 地区值是 IP 算出来的，不是输入框：不做边框，免得看着像能填 */
.setnote {
  padding: 6px 10px 4px;
  font-size: var(--fs-xs);
  color: var(--fg-3);
}

.invite-acts {
  display: flex;
  gap: 8px;
  padding: 2px 10px 10px;
}

/* 滑块开关：胶囊形，选中＝亮轨 + 深钮（无描边） */
.sw {
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
}

.sw input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  /* 点选会让复选框进入 :focus-visible。框本身是透明的，但系统描边和下面的光环会留在开关上。 */
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  box-shadow: none;
}

.sw i {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: var(--r-full);
  background: var(--panel-3);
  transition: background .16s ease;
}

.sw i::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--fg-3);
  transition: transform .16s ease, background .16s ease;
}

.sw input:checked + i { background: var(--solid); }

.sw input:checked + i::after {
  transform: translateX(18px);
  background: var(--solid-fg);
}

.sw input:focus,
.sw input:focus-visible,
.sw input:active {
  outline: none;
  box-shadow: none;
}
/* 选中只靠亮轨，点击和键盘焦点都不加一圈框 */
.sw input:focus + i,
.sw input:focus-visible + i,
.sw input:active + i {
  box-shadow: none;
}

.sw input:active + i::after { background: var(--fg-2); }
.sw input:checked:active + i::after { background: var(--solid-fg); }

.form {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: 16px 0 28px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.form h2 { margin: 0 0 8px; font-size: 20px; font-weight: 500; }
.form .lead { margin: 0 0 18px; font-size: 13px; color: var(--fg-2); }

/* 表单页头部：返回图标 + 标题一行，和聊天室头部同一套返回位置 */
.pagehead { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.pagehead h2 { margin: 0; }

.field { margin-bottom: 24px; }
.field label { display: block; font-size: 12px; color: var(--fg-3); margin-bottom: 8px; }

/* 输入框：填充面 + 聚焦再提亮一档（不再靠描边提示可编辑） */
.field input {
  width: 100%;
  height: var(--h-ctl);
  padding: 0 14px;
  border: 0;
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--fg);
  outline: none;
  transition: background .14s;
}

.field input:focus { background: var(--panel-3); }
.field input::placeholder { color: var(--fg-3); }

/* 注册时邮箱拆成「用户名 + 固定后缀」：输入框吃掉剩余宽度，后缀是等高的下拉。
   ⛔ [hidden] 的 display:none 打不过 .mail-domain-wrap 的 display:inline-flex，得单写一条。 */
.mail-row { display: flex; align-items: center; gap: 8px; }
.mail-row > input { flex: 1 1 auto; width: auto; min-width: 0; }
.mail-domain-wrap { position: relative; flex: 0 0 auto; display: inline-flex; }
.mail-domain-wrap[hidden] { display: none; }

.mail-domain {
  -webkit-appearance: none;
  appearance: none;
  height: var(--h-ctl);
  padding: 0 30px 0 13px;
  border: 0;
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--fg);
  font-size: 14px;
  line-height: var(--h-ctl);
  outline: none;
  cursor: pointer;
  transition: background .14s;
}
.mail-domain:hover,
.mail-domain:focus { background: var(--panel-3); }

/* 自绘 caret：深色填充面上的原生小箭头几乎看不见 */
.mail-domain-wrap::after {
  content: '';
  position: absolute;
  right: 13px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -4px;
  border-right: 1.4px solid var(--fg-3);
  border-bottom: 1.4px solid var(--fg-3);
  transform: rotate(45deg);
  pointer-events: none;
}

.hint { min-height: 16px; margin-top: 6px; font-size: 12px; color: var(--bad); }
.hint-soft { color: var(--fg-3); }

/* ---------- 年龄滑块 ---------- */

/* 年龄滑杆：数字做成胶囊气泡，跟着 thumb 走（--r 由 JS 按当前值写在 .ageslider 上） */
.ageslider { position: relative; padding-top: 28px; min-width: 0; }

.agebubble {
  position: absolute;
  top: 0;
  /* thumb 20px 宽、中心从 10px 走到 (100% - 10px)，气泡中心与之对齐 */
  left: calc(10px + (100% - 20px) * var(--r, 0));
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border: 0;
  border-radius: var(--r-full);
  background: var(--panel-3);
  white-space: nowrap;
  pointer-events: none;
}
.agebubble b {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.field input.age-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  background-image: linear-gradient(to right,
    var(--fg-2) 0 calc(10px + (100% - 20px) * var(--r, 0)),
    var(--panel-3) calc(10px + (100% - 20px) * var(--r, 0)) 100%);
  background-size: 100% 4px;
  background-position: 0 50%;
  background-repeat: no-repeat;
  outline: none;
  cursor: pointer;
  touch-action: pan-y;
}

.field input.age-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: var(--fg-2);
  box-shadow: 0 0 0 4px var(--bg);
  transition: transform .12s ease;
}
.field input.age-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: var(--fg-2);
  box-shadow: 0 0 0 4px var(--bg);
}
.field input.age-range::-moz-range-track { background: transparent; }

.field input.age-range:hover::-webkit-slider-thumb,
.field input.age-range:active::-webkit-slider-thumb { transform: scale(1.12); }

.field input.age-range:focus-visible { outline: none; }
.field input.age-range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px var(--fg-3);
}

.agescale {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  font-size: var(--fs-xs);
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}

.namerow { display: flex; align-items: center; gap: 8px; }
.namerow input { flex: 1; min-width: 0; letter-spacing: .02em; }
.namerow .ghost { flex: none; height: var(--h-ctl); padding: 0 14px; }

/* 随机换一个昵称：输入框右侧的骰子按钮（填充面，和输入框同档） */
.namerow .rand {
  flex: none;
  width: var(--h-ctl);
  height: var(--h-ctl);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--fg-3);
  cursor: pointer;
  transition: color .15s, background .15s;
}
.namerow .rand:hover { color: var(--fg); background: var(--panel-3); }
.namerow .rand:active { background: var(--panel-2); }
.namerow .rand:focus-visible { outline: none; color: var(--fg); background: var(--panel-3); }
.namerow .rand svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.namerow .rand[hidden] { display: none; }

/* 昵称可用性提示：可用给绿、占用露红，检查中压低对比，别抢标题的注意力 */
.hint.namehint { color: var(--fg-3); }
.hint.namehint.is-ok { color: var(--ok); }
.hint.namehint.is-bad { color: var(--bad); }
.hint.namehint.is-dim { color: var(--fg-3); opacity: .75; }

.seg { display: flex; gap: 8px; }
/* 选中态：提亮一档填充 + 文字转亮，不描边 */
.seg .ghost.sel { background: var(--panel-3); color: var(--fg); }

/* 性别选择：图标在上、文案在下，三列等宽（窄屏也不挤） */
.gseg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gopt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 58px;
  padding: 0 4px;
  border: 0;
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--fg-3);
  font-size: var(--fs-xs);
  line-height: 1;
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.gopt:hover { color: var(--fg-2); background: var(--panel-3); }
.gopt.sel { background: var(--panel-3); color: var(--fg); }
.gopt .gi {
  width: 17px;
  height: 17px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.form-acts { display: flex; gap: 8px; margin-top: 28px; }
.form-acts .solid { flex: 1; height: var(--h-ctl); }
.form-acts .ghost { height: var(--h-ctl); padding: 0 18px; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.link {
  margin: 14px 0 0;
  border: none;
  background: none;
  padding: 0;
  font-size: 12px;
  color: var(--fg-3);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link:hover { color: var(--fg-2); }

.form-foot { margin-top: 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.form-foot .link { margin: 0; }
.link.danger-link { color: var(--bad); }
.link.danger-link:hover { color: var(--bad); }

/* 顶栏右上角：全站唯一的账号 / 我的入口（胶囊小 chip） */
.acct-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 180px;
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-full);
  background: var(--panel-2);
  color: var(--fg-3);
  font-size: var(--fs-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .15s, background .15s;
}

.acct-btn:hover { color: var(--fg); background: var(--panel-3); }
.acct-btn.on { color: var(--fg-2); }
.acct-btn.on:hover { color: var(--fg); }

/* 已登录：名字前面点一颗绿灯，一眼看出「现在是这个身份」 */
.acct-btn.on::before {
  content: "";
  flex: none;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ok);
}

.bar-acts { display: flex; align-items: center; gap: 8px; flex: none; }
.acct-btn[hidden] { display: none; }

/* ---------- 按钮 ----------
   两种：主按钮实心亮底（全站唯一），次按钮填充深灰面。都不描边。 */

.solid {
  height: var(--h-ctl);
  padding: 0 20px;
  border: 0;
  border-radius: var(--r);
  background: var(--solid);
  color: var(--solid-fg);
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, opacity .15s;
}

.solid:hover { background: var(--solid-hover); }
.solid:disabled { opacity: .3; cursor: not-allowed; background: var(--solid); }

/* 能用图标说清的动作：24px 描边，不另写文字 */
.ibtn {
  flex: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--fg-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s;
}
.ibtn.sm { width: 36px; height: 36px; border-radius: var(--r-sm); }
.ibtn.solid { background: var(--solid); color: var(--solid-fg); }
.ibtn.ghost-icon { background: transparent; }
.ibtn svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ibtn:hover { color: var(--fg); background: var(--panel-3); }
.ibtn.solid:hover { background: var(--solid-hover); color: var(--solid-fg); }
.ibtn:disabled { opacity: .35; cursor: not-allowed; }

.ghost {
  height: var(--h-ctl-sm);
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  color: var(--fg-2);
  font-size: 13px;
  transition: color .15s, background .15s;
}

.ghost:hover { color: var(--fg); background: var(--panel-3); }
.ghost.sm { height: var(--h-ctl-xs); padding: 0 12px; font-size: 12px; border-radius: var(--r-sm); }
.ghost:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- 匹配中 ---------- */

.waiting {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 18px;
}

/* 呼吸点：三层实心圆扩散（不用描边圆环，免得又是线条感） */
.pulse {
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: var(--pulse);
  position: relative;
}

.pulse::before,
.pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--pulse-ring);
  animation: ripple 2s ease-out infinite;
}

.pulse::after { animation-delay: 1s; }

@keyframes ripple {
  0% { transform: scale(1); opacity: .9; }
  100% { transform: scale(2.2); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .pulse::before, .pulse::after { animation: none; }
}

.waiting .txt { font-size: 13px; color: var(--fg-2); }

/* 主文案 + 排队人数：两句贴在一起读，别被 .waiting 的 18px 间距拉开 */
.waitmain {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.waitnum {
  font-size: var(--fs-sm);
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}

.waitnum[hidden] { display: none; }

/* 本次匹配规则：只读，胶囊小 chip（匹配中不允许改规则，要改先取消） */
.waitrule {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 0;
  border-radius: var(--r-full);
  background: var(--panel-2);
}

.waitrule .k { font-size: var(--fs-xs); color: var(--fg-3); }
.waitrule .v { font-size: var(--fs-md); color: var(--fg); }

/* .waiting 是 18px gap，提示要贴着规则行读，用负 margin 抵消一半 */
.waithint {
  margin: -8px 0 0;
  font-size: var(--fs-sm);
  color: var(--fg-3);
  text-align: center;
}

/* ---------- 聊天 ---------- */

.chat-head {
  flex: none;
  min-height: 52px;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 6px;
  border-bottom: 0;
}

.who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.who .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--fg);
}
.who .sub {
  margin-top: 1px;
  font-size: 13px;
  font-weight: 400;
  color: var(--fg-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 没内容就别占一行（消息页在「0 个人」时把副标题留空） */
.who .sub:empty { display: none; }
.acts { display: flex; gap: 6px; flex: none; }

/* 文档页头部的返回图标。聊天室列表不再用它，窄屏进房用 .tg-back。 */
.head-l { display: flex; align-items: center; gap: 10px; min-width: 0; }

.backbtn {
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  color: var(--fg-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s;
}

.backbtn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.backbtn:hover { color: var(--fg); background: var(--panel-3); }
.backbtn:focus-visible { outline: none; color: var(--fg); background: var(--panel-3); }

/* 窄屏房间头：只有一颗箭头，回到房间列表。宽屏两栏时整颗收掉。 */
.tg-back {
  flex: none;
  width: 32px;
  height: 36px;
  margin: 0 0 0 -8px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tg-back svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tg-back:hover,
.tg-back:focus-visible {
  background: transparent;
  color: var(--fg-2);
  outline: none;
}

/* 对方的展示信息：三颗胶囊 chip，靠间距分开，不再画竖线 */
.pinfo {
  flex: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 0;
  border-bottom: 0;
}

/* display:flex 会吃掉 hidden 的默认表现，必须显式压住 */
.pinfo[hidden] { display: none; }

.pinfo .i {
  flex: none;
  max-width: 100%;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--r-full);
  background: var(--panel-2);
}

.pinfo .i + .i {
  padding-left: 11px;
  border-left: 0;
}

.pinfo .k { flex: none; font-size: var(--fs-xs); color: var(--fg-3); }

.pinfo .v {
  font-size: var(--fs-md);
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pinfo .v.mute { color: var(--fg-3); }

.msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 0 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* 新消息顶上来时滚底用 JS smooth，这里不设 scroll-behavior 以免历史回放也慢吞吞 */
}

/* 换边时稍拉开，同一边的气泡贴在一起 */
.bubble.me + .bubble.them,
.bubble.them + .bubble.me,
.msg-mine + .bubble.them,
.bubble.them + .msg-mine,
.lmsg.mine + .lmsg.them,
.lmsg.them + .lmsg.mine { margin-top: 8px; }

/* 新消息入场：从下淡入，旧消息被顶上去时更顺 */
@keyframes msg-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.msgs > .msg-enter {
  animation: msg-in .32s cubic-bezier(.2, .85, .25, 1) both;
}
@media (prefers-reduced-motion: reduce) {
  .msgs > .msg-enter { animation: none; }
}

.empty {
  margin: auto;
  font-size: var(--fs-md);
  color: var(--fg-3);
  text-align: center;
}

/* 系统提示：小胶囊，压得比消息气泡还淡 */
.sys {
  align-self: center;
  max-width: 80%;
  font-size: 12px;
  color: var(--fg-3);
  padding: 4px 12px;
  border-radius: var(--r-full);
  background: var(--panel);
  text-align: center;
}

/* 气泡：左入右出，圆角放开，竖向贴紧。颜色跟主题走（--bubble-me / --bubble-them）。
   ⛔ 自己的气泡类名也是 .me，会撞上「我的」页那条 .me（flex 列 + 大留白）。
      这里用 .bubble.me 把那些属性盖回去，短消息才不会被挤成一根。 */
.bubble {
  display: block;
  width: max-content;
  max-width: 78%;
  padding: 9px 14px 10px;
  border: 0;
  border-radius: 20px 20px 20px 6px;
  font-size: var(--fs-msg);
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
}

.bubble.them {
  align-self: flex-start;
  background: var(--bubble-them);
  color: var(--bubble-them-fg);
}

.bubble.me {
  flex: none;
  gap: 0;
  min-height: 0;
  overflow: visible;
  display: block;
  align-self: flex-end;
  width: max-content;
  padding: 9px 14px 10px;
  background: var(--bubble-me);
  color: var(--bubble-me-fg);
  border-radius: 20px 20px 6px 20px;
}

.bubble .btext { display: block; white-space: pre-wrap; word-break: break-word; }

/* 自己的消息：气泡 + 下方对勾（单勾送达，双勾已读且蓝色） */
.msg-mine {
  align-self: flex-end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: 78%;
  gap: 3px;
}
.msg-mine .bubble.me {
  max-width: 100%;
}
.msg-mine .ticks {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 0 4px;
  font-size: 12px;
  line-height: 1;
  letter-spacing: -2px;
  color: var(--fg-3);
  user-select: none;
}
.msg-mine .ticks[hidden] { display: none; }
.msg-mine .ticks.read { color: #4C8DFF; }
.msg-mine .ticks .tick { display: inline-block; }

/* 长按选中态 */
.bubble.msg-press {
  filter: brightness(1.12);
  transform: scale(1.02);
  transition: transform .12s ease, filter .12s ease;
}
.msg-mine.msg-press .bubble {
  filter: brightness(1.12);
  transform: scale(1.02);
  transition: transform .12s ease, filter .12s ease;
}

/* 已撤回 / 已销毁：还停在原来的左右气泡里，只把字压淡 */
.bubble.gone {
  font-size: var(--fs-sm);
}
.bubble.me.gone { color: color-mix(in srgb, var(--bubble-me-fg) 58%, transparent); }
.bubble.them.gone { color: color-mix(in srgb, var(--bubble-them-fg) 55%, transparent); }

.msgact-acts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 12px;
}
.msgact-acts .ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--h-ctl);
}
.msgact-acts .ghost[hidden] { display: none; }
.msgact-acts .ghost.danger { color: var(--bad); }

/* 限次图片：气泡里只有图标和次数，像素要等对方点开才出现。颜色跟气泡主题走。 */
button.bubble {
  font: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
button.img-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: normal;
}
button.img-bubble.is-spent { cursor: default; opacity: .72; }
.img-bubble .img-ico {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, currentColor 14%, transparent);
  color: inherit;
}
.img-bubble .img-ico svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.img-bubble .img-cap { display: flex; flex-direction: column; min-width: 0; }
.img-bubble .img-t { font-size: var(--fs-msg); line-height: 1.3; }
.img-bubble .img-s { margin-top: 2px; font-size: var(--fs-sm); line-height: 1.3; opacity: .78; }

/* 时间条：居中小字，不贴在每条气泡上。两套主题都用次级字色。 */
.timechip {
  align-self: center;
  flex: none;
  margin: 10px 0 4px;
  padding: 2px 10px;
  border-radius: var(--r-full);
  background: var(--panel);
  color: var(--fg-3);
  font-size: var(--fs-sm);
  line-height: 1.5;
  text-align: center;
}

/* 「正在输入」：消息流末尾的一颗对方气泡，三点依次跳动。
   ⛔ 别再给它留常驻高度（旧版是一行 18px 的 opacity 0 文字），
      没有输入时这颗气泡根本不在 DOM 里，消息区自然占满。 */
.typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 15px 16px;   /* 上下留够，别让它比一行文字矮太多 */
}

.typing-bubble .tdot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fg-3);
  opacity: .4;
  animation: tdot 1.1s infinite ease-in-out;
}

.typing-bubble .tdot:nth-child(2) { animation-delay: .16s; }
.typing-bubble .tdot:nth-child(3) { animation-delay: .32s; }

@keyframes tdot {
  0%, 100% { opacity: .35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .typing-bubble .tdot { animation: none; opacity: .55; }
}

/* 对方暂时离线：一块软填充的小提示，不弹窗、不结束对话 */
.pnote {
  flex: none;
  margin-top: 10px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--r);
  background: var(--panel-2);
  font-size: 12px;
  color: var(--fg-3);
}

.pnote[hidden] { display: none; }

.compose {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  /* iPhone 底部横条：不加安全区，「离开」和「发送」会压到 home indicator 上 */
  padding: 6px 0 calc(10px + env(safe-area-inset-bottom));
  border-top: 0;
  background: transparent;
}

/* 1v1 输入条悬浮：脱离文档流贴在对话页底；键盘弹起时 .app 钉在 visualViewport，条自然贴键盘 */
body.chat-compose-float .view[data-view="chat"] .msgs {
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
}
body.chat-compose-float .view[data-view="chat"] .msgs.compose-tall {
  padding-bottom: calc(var(--compose-pad, 78px) + env(safe-area-inset-bottom));
}
body.chat-compose-float .view[data-view="chat"] .compose {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  box-sizing: border-box;
  padding-left: var(--inset);
  padding-right: var(--inset);
  z-index: 20;
  background: var(--bg);
  box-shadow: 0 -10px 24px rgba(0, 0, 0, .22);
}
html[data-theme="day"] body.chat-compose-float .view[data-view="chat"] .compose {
  box-shadow: 0 -10px 24px rgba(16, 16, 20, .08);
}

/* 键盘钉住时：.app 钉在 visualViewport；顶栏吸顶，跟底栏一起跟着可视区走。不加 transition。 */
body.vv-pin .app {
  overflow: hidden;
  will-change: transform, height;
}
body.vv-pin .bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg);
}
body.vv-pin .compose {
  padding-bottom: 10px;
}
body.vv-pin .chat-over {
  padding-bottom: 12px;
}

/* 弹层避键盘：只抬宿主 bottom（.kb-lift），不动整页，入场不会闪回 */
.sheet-wrap.kb-lift .sheet,
#login.kb-lift .sheet,
#feedpost.kb-lift .sheet {
  max-height: 100%;
  padding-bottom: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal.kb-lift .modal-card {
  max-height: calc(100% - 24px);
}

.compose input,
.compose textarea {
  flex: 1;
  min-width: 0;
  height: 42px;
  min-height: 42px;
  max-height: 120px;
  padding: 10px 16px;
  border: 0;
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--fg);
  font: inherit;
  font-size: var(--fs-msg);
  line-height: 1.4;
  outline: none;
  resize: none;
  overflow-y: auto;
  field-sizing: content;
  transition: background .14s;
}

.compose input:focus,
.compose textarea:focus { background: var(--panel-3); }
.compose input::placeholder,
.compose textarea::placeholder { color: var(--fg-3); }
.compose[hidden] { display: none; }

/* 多行时发送钮贴底，别跟着被拉高 */
.compose .ibtn,
.compose .leave-quiet {
  flex: none;
  margin-bottom: 1px;
}

/* 1v1 结束：仍留在对话页，底部提示 + 重新匹配（不跳结束页） */
.chat-over {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 10px 0 calc(12px + env(safe-area-inset-bottom));
  background: var(--bg);
}
.chat-over[hidden] { display: none; }
.chat-over-tip {
  margin: 0;
  text-align: center;
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--fg-3);
}
.chat-over .ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--h-ctl);
  width: 100%;
}
body.chat-compose-float .view[data-view="chat"].chat-done .msgs {
  padding-bottom: calc(110px + env(safe-area-inset-bottom));
}
body.chat-compose-float .view[data-view="chat"].chat-done .chat-over {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  box-sizing: border-box;
  padding-left: var(--inset);
  padding-right: var(--inset);
  z-index: 20;
  background: var(--bg);
  box-shadow: 0 -10px 24px rgba(0, 0, 0, .22);
}
html[data-theme="day"] body.chat-compose-float .view[data-view="chat"].chat-done .chat-over {
  box-shadow: 0 -10px 24px rgba(16, 16, 20, .08);
}

/* 发送：圆钮，跟主题实心按钮同一套，不做成方块工具条 */
.compose .ibtn.solid {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--solid);
  color: var(--solid-fg);
}
.compose .ibtn.solid svg { width: 20px; height: 20px; }
.compose .ibtn.solid:hover,
.compose .ibtn.solid:focus-visible {
  background: var(--solid-hover);
  color: var(--solid-fg);
}
.compose .ibtn:not(.solid) {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}
.compose .ibtn:not(.solid) svg { width: 20px; height: 20px; }

/* 发出去之前：缩略图和「看1次 / 看2次」。缩略图只在自己这一侧的待发条上，不进对方的气泡。 */
.imgstage {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 8px;
  border-radius: var(--r);
  background: var(--panel-2);
}
.imgstage[hidden] { display: none; }
.imgstage img {
  flex: none;
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--r-sm);
  background: var(--panel);
}
.imgstage-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.imgstage-k { font-size: var(--fs-sm); color: var(--fg-2); }
.imgstage .seg { flex-wrap: wrap; }
.imgstage .ibtn.solid {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--solid);
  color: var(--solid-fg);
}
.imgstage .ibtn.solid svg { width: 20px; height: 20px; }
.imgstage .ibtn.solid:hover,
.imgstage .ibtn.solid:focus-visible {
  background: var(--solid-hover);
  color: var(--solid-fg);
}

.imgview {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  background: var(--mask);
}
.imgview[hidden] { display: none; }
.imgview-x { position: absolute; top: 16px; right: 16px; }
.imgview img {
  max-width: min(92vw, 520px);
  max-height: 70vh;
  border-radius: var(--r-lg);
  object-fit: contain;
  background: var(--panel);
}
.imgview-note {
  margin: 0;
  max-width: 92vw;
  color: var(--fg);
  font-size: var(--fs-sm);
  text-align: center;
}

/* 1v1 离开：贴在输入行左缘的一行淡字，不是返回按钮 */
.leave-quiet {
  flex: none;
  align-self: center;
  height: auto;
  margin: 0;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--fg-3);
  font-size: 13px;
  font-weight: 400;
  line-height: 1;
}
.leave-quiet:hover,
.leave-quiet:focus-visible {
  background: transparent;
  color: var(--fg-2);
  outline: none;
}


/* 游客只读：占位高度与输入区一致，进来时布局不跳 */
.guestbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0 calc(12px + env(safe-area-inset-bottom));
  border-top: 0;
}

.guestbar[hidden] { display: none; }
#btn-guest-reg[hidden],
#btn-profile-login[hidden],
#btn-feed-login[hidden] { display: none; }

.guestbar .gtxt {
  font-size: 12px;
  color: var(--fg-3);
}

.report-reasons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 12px;
}
.report-reasons .ghost {
  width: 100%;
  height: var(--h-ctl);
  justify-content: center;
}

.toast {
  position: absolute;   /* 相对 .app 卡片定位，桌面上不会掉到卡片外面 */
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  z-index: 60;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--r-full);
  background: var(--panel-3);
  font-size: 12px;
  color: var(--fg);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}

.toast.on { opacity: 1; }

/* ---------- 结束 / 封禁 ---------- */

.over {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.over h2 { margin: 0; font-size: 18px; font-weight: 500; }
.over p { margin: 0; font-size: 13px; color: var(--fg-2); }
.over .ghost { margin-top: 8px; height: var(--h-ctl); padding: 0 20px; }

/* ---------- 管理后台 ---------- */

/* 后台比聊天端宽一档：左边菜单占 186，右边表格才有地方横着排 */
.admin { max-width: 1240px; }
.admin .bar .meta a { margin-left: 12px; color: var(--fg-2); text-decoration: none; }
.admin .bar .meta a:hover { color: var(--fg); }

/* ---------- 后台骨架：左菜单 + 右内容（各自独立滚动） ---------- */

.admin-body {
  flex: 1;
  min-height: 0;
  display: flex;
}
.admin-body[hidden] { display: none; }   /* ⛔ display:flex 会盖掉 hidden，必须显式 */

.admin-nav {
  flex: none;
  width: 180px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 16px 24px 0;
  border-right: 0;          /* 分栏靠留白，不画竖线 */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 分组小标题：只做分区提示，不做可点的东西 */
.admin-nav-g {
  padding: 14px 10px 4px;
  font-size: var(--fs-xs);
  line-height: 1.4;
  letter-spacing: .06em;
  color: var(--fg-3);
}

/* 菜单项：圆角填充块，选中＝提亮一档（不再用左侧竖线） */
.admin-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--h-ctl-sm);
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--fg-2);
  font-size: var(--fs-md);
  line-height: 1;
  text-align: left;
  white-space: nowrap;
  transition: color .12s, background .12s;
}

.admin-tab:hover { color: var(--fg); background: var(--panel-2); }
.admin-tab:focus-visible { outline: none; color: var(--fg); background: var(--panel-2); }

.admin-tab.on { color: var(--fg); background: var(--panel-2); }

/* 菜单上的计数：安静地靠右，只有待处理举报带警示色 */
.admin-tab .n {
  margin-left: auto;
  font-size: var(--fs-xs);
  line-height: 1;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}
.admin-tab.on .n { color: var(--fg-2); }
.admin-tab .n.warn { color: var(--warn); }
.admin-tab .n[hidden] { display: none; }   /* ⛔ flex 子项，hidden 要显式压住 */

.admin-main {
  flex: 1;
  min-width: 0;
  padding: 16px 0 40px 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ---------- 后台：房间最近消息（只读内存，房结束即消失） ---------- */

.amsg {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.amsg[hidden] { display: none; }   /* ⛔ display:flex 会盖掉 hidden，必须显式 */

.amsg-mask {
  position: absolute;
  inset: 0;
  background: var(--mask);
  animation: fade .14s ease;
}

.amsg-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: min(72vh, 680px);
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: var(--r-xl);
  background: var(--panel);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  animation: fade .14s ease;
}

.amsg-h {
  flex: none;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.amsg-h b { font-size: var(--fs-base); font-weight: 500; }
.amsg-h .snap { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.amsg-x {
  margin-left: auto;
  flex: none;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  color: var(--fg-3);
  font-size: 15px;
  line-height: 1;
  transition: color .12s, background .12s;
}
.amsg-x:hover { color: var(--fg); background: var(--panel-3); }

.amsg-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 18px 12px;
}

/* 一行一条：时间 / 说话人 / 正文，正文折行，不撑破卡片 */
.amsg-row {
  display: grid;
  grid-template-columns: 42px 88px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-md);
  line-height: 1.55;
}
.amsg-row:last-child { border-bottom: none; }

.amsg-t { font-size: var(--fs-xs); color: var(--fg-3); font-variant-numeric: tabular-nums; }
.amsg-who { color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amsg-text { color: var(--fg); white-space: pre-wrap; word-break: break-word; }

.amsg-empty { padding: 32px 0; text-align: center; color: var(--fg-3); font-size: var(--fs-sm); }

.amsg-f {
  flex: none;
  padding: 11px 18px 13px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--fg-3);
}

@media (max-width: 720px) {
  .amsg { padding: 12px; }
  .amsg-card { max-height: min(78vh, 720px); }
  .amsg-row { grid-template-columns: 38px 66px minmax(0, 1fr); gap: 6px; }
}

/* ---------- 后台：数据库面板（连接信息 + 下钻弹窗） ---------- */

/* 连接状态条：一堆 chip，进面板第一眼看到「连的哪个库、占多大」 */
.dbstat {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.dbstat[hidden] { display: none; }

.dbstat-i {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  background: var(--panel-2);
  font-size: var(--fs-sm);
  color: var(--fg-2);
}
.dbstat-i .snap { font-size: var(--fs-xs); }
.dbstat-i .mono { color: var(--fg); }

/* 下钻弹窗：比「最近消息」宽一档，列多才有地方铺开 */
.dbv-card { max-width: 900px; }

.dbv-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 6px 18px 14px;
  -webkit-overflow-scrolling: touch;
}
.dbv-list table { font-size: var(--fs-sm); }
.dbv-list th { position: sticky; top: 0; z-index: 1; background: var(--panel); }
.dbv-list th,
.dbv-list td {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dbv-list td { color: var(--fg-2); }

.admin-panel[hidden] { display: none; }
/* 面板里第一块不要顶出 28px 空档（.sec 的默认上间距是给长列表用的） */
.admin-panel > .sec:first-child { margin-top: 0; }
.admin .sec-h + .cards { margin-top: 14px; }

/* ---------- 后台：1v1 房间 左列表 + 右聊天框 ---------- */

.rooms-split {
  display: flex;
  align-items: stretch;
  gap: 14px;
}
.rooms-split[hidden] { display: none; }   /* ⛔ display:flex 会盖掉 hidden，必须显式 */

/* 左：进行中的对话列表（一整块填充面，条目是里面的圆角小条） */
.rooms-list {
  flex: none;
  width: 300px;
  max-height: 540px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--panel);
}
.rooms-list .row-empty { padding: 40px 12px; }

.roomitem {
  position: relative;
  padding: 10px 12px;
  border-radius: var(--r);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.roomitem:last-child { border-bottom: none; }
.roomitem:hover { background: var(--panel-2); }
.roomitem:focus-visible { outline: none; background: var(--panel-2); }
/* 选中态：提亮到三级面 + 文字转亮 */
.roomitem.on { background: var(--panel-3); }

.roomitem-who {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-base);
}
.roomitem-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: var(--fs-xs);
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}

/* 在线状态小圆点：双方都在 = 绿，一方挂起 = 灰 */
.rvdot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--fg-3); }
.rvdot.ok { background: var(--ok); }

/* 右：聊天框 */
.rooms-view {
  flex: 1;
  min-width: 0;
  max-height: 540px;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--panel);
  overflow: hidden;
}

.rv-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--fg-3);
  font-size: var(--fs-sm);
  text-align: center;
  line-height: 1.8;
}
.rv-empty[hidden] { display: none; }

.rv { flex: 1; min-height: 320px; display: flex; flex-direction: column; }
.rv[hidden] { display: none; }   /* ⛔ display:flex 会盖掉 hidden，必须显式 */

.rv-h {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.rv-h b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-base);
  font-weight: 500;
}
.rv-h .snap { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-h .ghost { margin-left: auto; flex: none; }

.rv-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 双方各占一侧：A 靠左深面，B 靠右更深一档；行宽随内容收缩
   （⛔ 不加 align-self 会被列表拉伸成通栏） */
.rv-row { display: flex; flex-direction: column; gap: 3px; max-width: 78%; align-self: flex-start; }
.rv-row.r { align-self: flex-end; align-items: flex-end; }
.rv-meta { font-size: var(--fs-xs); color: var(--fg-3); font-variant-numeric: tabular-nums; }
.rv-bubble {
  padding: 8px 12px;
  border: 0;
  border-radius: 16px 16px 16px 6px;
  background: var(--panel-2);
  font-size: var(--fs-base);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.rv-row.r .rv-bubble { background: var(--panel-3); border-radius: 16px 16px 6px 16px; }
.rv-status { margin-top: 4px; font-size: var(--fs-xs); line-height: 1.4; color: var(--fg-3); }

/* 窄屏：列表叠在上面（限高可滚），聊天框铺满下方 */
@media (max-width: 900px) {
  .rooms-split { flex-direction: column; }
  .rooms-list { width: auto; max-height: 220px; }
  .rooms-view { max-height: none; }
  .rv { min-height: 300px; }
}

/* ---------- 后台：举报记录（左列表 + 右聊天快照，复用 rooms-split） ---------- */

.rp-split { margin-top: 14px; }
.rp-split .rp-list,
.rp-split .rp-view {
  max-height: min(68vh, 640px);
}
.rp-list .roomitem { padding: 11px 12px; }
.rp-rv-h {
  flex-wrap: wrap;
  align-items: flex-start;
  row-gap: 8px;
}
.rp-rv-h .hist-rv-title { flex: 1 1 auto; min-width: 0; }
.rp-rv-h .hist-rv-meta {
  flex: 1 1 100%;
  order: 3;
  white-space: normal;
}
.rp-acts {
  margin-left: auto;
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.rp-acts .ghost + .ghost { margin-left: 0; }   /* 用 gap，别再叠 margin */

@media (max-width: 900px) {
  .rp-split .rp-list { max-height: 240px; }
  .rp-split .rp-view { max-height: none; }
}

/* ---------- 后台：历史会话（1v1 + 聊天室，子 tab 切换） ---------- */

.hist-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* 种类分段：全部 / 1v1 / 聊天室 —— 跟分享顶栏同一套胶囊口径 */
.hist-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0;
  height: 32px;
  padding: 2px;
  border-radius: var(--r-full);
  background: var(--panel-2);
}
.hist-tab {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  margin: 0;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--fg-2);
  font: inherit;
  font-size: var(--fs-md);
  line-height: 1;
  cursor: pointer;
  transition: color .12s, background .12s;
}
.hist-tab:hover { color: var(--fg); }
.hist-tab:focus-visible { outline: none; color: var(--fg); }
.hist-tab.on {
  background: var(--panel-3);
  color: var(--fg);
}
html[data-theme="day"] .hist-tab.on { background: var(--panel); }

.hist-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 200px;
  justify-content: flex-end;
}
.hist-search input {
  height: var(--h-ctl-sm);
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  color: var(--fg);
  outline: none;
  width: min(280px, 100%);
  font: inherit;
}
.hist-search input::placeholder { color: var(--fg-3); }
.hist-search input:focus { background: var(--panel-3); }

/* 历史两栏：比实时房间略高，翻记录更舒服 */
.hist-split {
  margin-top: 14px;
}
.hist-split .hist-list,
.hist-split .hist-view {
  max-height: min(68vh, 640px);
}
.hist-list .roomitem { padding: 11px 12px; }

/* 比聊天端 .roomitem { align-items:center } 更具体，名称/时间靠左 */
.hist-list .roomitem.hist-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 4px;
  text-align: left;
}
.hist-item-top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
  width: 100%;
  text-align: left;
}
.hist-item-who {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-base);
  text-align: left;
}
.hist-item-top .hist-badge { margin-left: auto; flex: none; }
/* 时间 / 条数单独一行，不跟标题挤在一起 */
.hist-item-meta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
  width: 100%;
  font-size: var(--fs-xs);
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
  text-align: left;
}
.hist-item-time,
.hist-item-count,
.hist-item-live { flex: none; }
.hist-item-count::before,
.hist-item-live::before {
  content: '·';
  margin-right: 6px;
  color: var(--fg-3);
}

/* 种类徽标：1v1 / 聊天室一眼可分 */
.hist-badge,
.hist-kind {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 7px;
  border-radius: var(--r-full);
  font-size: 10px;
  line-height: 1;
  letter-spacing: .02em;
  color: var(--fg-2);
  background: var(--panel-3);
}
.hist-badge.chat,
.hist-kind.chat {
  color: #A8D08D;
  background: rgba(168, 208, 141, .14);
}
.hist-badge.room,
.hist-kind.room {
  color: #7EB8DA;
  background: rgba(126, 184, 218, .14);
}
html[data-theme="day"] .hist-badge.chat,
html[data-theme="day"] .hist-kind.chat {
  color: #2F6B3A;
  background: rgba(47, 107, 58, .10);
}
html[data-theme="day"] .hist-badge.room,
html[data-theme="day"] .hist-kind.room {
  color: #1F5F8B;
  background: rgba(31, 95, 139, .10);
}

.hist-hit {
  margin-left: 4px;
  color: var(--warn);
  font-size: var(--fs-xs);
}
.hist-snip {
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-xs);
  color: var(--fg-3);
  line-height: 1.4;
}

/* 详情头：标题一行，时间/条数另起一行 */
.hist-rv-h {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.hist-rv-title {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
  width: 100%;
  text-align: left;
}
.hist-rv-title b {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.hist-rv-title .hist-kind { margin-left: auto; flex: none; }
.hist-rv-meta {
  display: block;
  width: 100%;
  font-size: var(--fs-xs);
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}

/* 聊天室：气泡左侧色条跟昵称同色，多人好辨认 */
.hist-chat .hist-chat-row { max-width: 88%; }
.hist-chat .rv-bubble {
  border-radius: 6px 16px 16px 16px;
  background: var(--panel-2);
}
.hist-nick { font-weight: 500; }

@media (max-width: 900px) {
  .hist-toolbar { align-items: stretch; }
  .hist-search { justify-content: stretch; }
  .hist-search input { width: 100%; flex: 1; }
  .hist-split .hist-list { max-height: 240px; }
  .hist-split .hist-view { max-height: none; }
}

/* 窄屏：左菜单折成可横滑的 tab 条，内容回到单列 */
@media (max-width: 900px) {
  .admin-body { flex-direction: column; }

  .admin-nav {
    flex-direction: row;
    gap: 6px;
    width: auto;
    padding: 10px 0;
    border-bottom: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .admin-nav::-webkit-scrollbar { height: 0; }

  .admin-nav-g { display: none; }

  .admin-tab {
    flex: none;
    height: var(--h-ctl-xs);
    padding: 0 12px;
    font-size: var(--fs-sm);
    background: var(--panel-2);
    border-radius: var(--r-full);
  }
  .admin-tab.on { background: var(--panel-3); }
  .admin-tab .n { margin-left: 5px; }

  .admin-main { padding: 14px 0 32px; }
  .admin .sec-h + .cards { margin-top: 12px; }
}

/* 登录门：盖满屏，验过密码才露出面板 */
.gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
}
.gate[hidden] { display: none; }   /* ⛔ display:flex 会盖掉 hidden，必须显式 */

.gate-card {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gate-brand { font-size: 15px; font-weight: 500; letter-spacing: .04em; }
.gate-brand .dot { margin-left: 3px; }
.gate-sub { font-size: 12px; color: var(--fg-3); margin-bottom: 6px; }

.gate-card input {
  height: var(--h-ctl);
  padding: 0 14px;
  border: 0;
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--fg);
  outline: none;
}
.gate-card input:focus { background: var(--panel-3); }

.gate-err { font-size: 12px; color: var(--bad); }
.gate-err[hidden] { display: none; }

.tokenbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--fg-3);
}

.tokenbar input {
  height: var(--h-ctl-sm);
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  color: var(--fg);
  outline: none;
  width: 220px;
}

.body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 0 32px; }

/* 概览数字卡：一整块填充面，同一屏等高（有副行 / 没副行不拉出高低差） */
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 1fr;
  gap: 10px;
}

.card {
  /* ⛔ 不要垂直居中：卡片等高后居中会让同一行的标签基线错开，看着像没对齐 */
  border: 0;
  border-radius: var(--r-lg);
  background: var(--panel);
  padding: 16px 18px;
}

/* 主卡（在线账号）：跨两列，数字放大，副行 + 一条「登录 / 在线」比例条 */
.card.lead { grid-column: span 2; }
.card.lead .v { font-size: 30px; }

.card .k { font-size: 12px; color: var(--fg-3); }
.card .v { font-size: 24px; font-weight: 500; margin-top: 4px; line-height: 1.2; }
.card .sub { font-size: 11px; color: var(--fg-3); margin-top: 3px; }

/* 卡片副行：几段小字并排（登录用户 / 排队 / 人在聊…） */
.card .f {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 6px;
  font-size: var(--fs-xs);
  color: var(--fg-3);
}
.card .f b { font-weight: 500; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.card .f b.hot { color: var(--warn); }

/* ⛔ .bar 在顶栏是 56px 高的分栏条，卡片里的比例条必须整块重置，
   否则卡片会被撑到 56 高、还挂一条底边。
   轨道压到几乎看不见（6% 白）：0% 的时候不该看起来像一条分隔线。 */
.card .bar {
  display: block;
  height: 4px;
  margin-top: 10px;
  border: 0;
  border-radius: var(--r-full);
  background: var(--track);
  overflow: hidden;
}
.card .bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: var(--r-full);
  background: var(--fg-2);
  transition: width .3s ease;
}

/* 风控卡：有事才染色，一切正常时保持安静 */
.card.warn { background: var(--warn-bg); }
.card.warn .v { color: var(--warn); }
.card.bad { background: var(--bad-bg); }
.card.bad .v { color: var(--bad); }

.sec { margin-top: 28px; }

.sec-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.sec-h h3 { margin: 0; font-size: 14px; font-weight: 500; }
.sec-h .n { font-size: 12px; color: var(--fg-3); }

/* 表格壳与表头：
   ⛔ border-collapse: collapse 时，sticky 表头的底边框会整条消失（Chrome/Safari 通病），
   所以改 separate + 用 box-shadow 画表头线（逐格 1px，不会叠成 2px）。 */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
th {
  text-align: left;
  font-weight: 400;
  font-size: 12px;
  color: var(--fg-3);
  padding: 10px 8px;
  border-bottom: 0;
  box-shadow: inset 0 -1px 0 var(--line);
}
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--fg-2); }
td.muted { color: var(--fg-2); }

/* 表格滚动壳：横滚 + 纵滚都由它承担，表头吸顶 */
.twrap {
  overflow: auto;
  max-height: min(56vh, 620px);
  -webkit-overflow-scrolling: touch;
}

/* 吸顶表头要盖住滚上来的行，底色必须不透明 */
.twrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg);
}

/* 行 hover：只提亮一点点，够看出「鼠标在哪一行」就行 */
.admin tbody tr:hover td { background: var(--wash); }

/* 空态收表：⛔ 依赖 HTML 里 .row-empty 排在 .twrap / .kwgrid 之前 */
.row-empty:not([hidden]) ~ .twrap,
.row-empty:not([hidden]) ~ .kwgrid { display: none; }

.snap { color: var(--fg-3); font-size: 12px; line-height: 1.5; }
.snap div { margin: 2px 0; }

.row-empty { padding: 28px 8px; text-align: center; color: var(--fg-3); font-size: 12px; }

/* 操作反馈：底部浮一条，2.4s 自动消失。
   以前是「把按钮文字改成结果再改回来」，多个动作并行时分不清是哪一条的结果。 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border: 0;
  border-radius: var(--r-full);
  background: var(--panel-3);
  color: var(--fg);
  font-size: 12px;
  line-height: 1.5;
  box-shadow: var(--shadow-toast);
  /* 110：压在弹层（100）之上、图片查看器（120）之下。
     ⛔ 原来是 90，比 .sheet-wrap / .modal（100）低 —— 「先登录才能只匹配异性」
        这类提示会跟着弹层一起被盖住，等于没提示。 */
  z-index: 110;
}
.toast.bad { color: var(--bad); background: var(--toast-bad-bg); }
.toast[hidden] { display: none; }   /* ⛔ 定宽定位会盖掉 hidden，必须显式 */

/* 账号目录的状态标记：对话中 / 排队中 / 在线 / 已挂起 / 未连接 / 已封禁 */
.st { font-size: 12px; }
.st-chat { color: var(--ok); }
.st-waiting { color: var(--warn); }
.st-idle { color: var(--fg-2); }
.st-offline, .st-never { color: var(--fg-3); }
.st-banned { color: var(--bad); }
td .devline { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--fg-2); }
td .devline .snap, td .devline button { margin-left: 6px; }
/* ⛔ 管理端表格一律单行排开：单元格不换行，一行一条记录；
   装不下时整个表格横向滚动（.sec 兜底），绝不竖着往高堆 */
.admin th, .admin td { white-space: nowrap; }
/* ⛔ 横向滚动只交给 .twrap：.sec 再套一层滚动容器，吸顶表头会失效 */
/* 同一格里的次级信息（ID / 注册时间 / 资料）跟主内容拉开 8px，横着排 */
.admin td > .snap:not(:first-child) { margin-left: 8px; }
/* 同一格里的并排按钮（封禁 / 删除）拉开 6px，别粘成一块 */
.admin td .ghost + .ghost { margin-left: 6px; }
.devsep { color: var(--line-2); margin: 0 8px; }
/* 举报消息快照：压成一行，超长省略号，悬停 title 看全文 */
.admin .clamp {
  display: inline-block;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.tools { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

.tools input {
  height: var(--h-ctl-sm);
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  color: var(--fg);
  outline: none;
  width: 260px;
}

.tools input::placeholder { color: var(--fg-3); }

/* 关键词屏蔽：分类下拉 + 批量粘贴框，跟 .tools input 同一套控件口径 */
.tools select,
.tools textarea {
  height: var(--h-ctl-sm);
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  color: var(--fg);
  outline: none;
  font: inherit;
  font-size: 13px;
}

.tools select { width: 104px; }
.tools textarea {
  height: 64px;
  min-height: 64px;
  padding: 9px 12px;
  line-height: 1.5;
  /* ⛔ 不要 resize:vertical：Chrome 会在右下角画一手把，暗色下看着像多了一条斜线 */
  resize: none;
  width: 360px;
}
.tools textarea::placeholder { color: var(--fg-3); }
.tools input:focus, .tools select:focus, .tools textarea:focus { background: var(--panel-3); }

.admin .hint { margin-top: 8px; margin-bottom: 10px; font-size: 12px; line-height: 1.6; color: var(--fg-3); }
.admin .hint code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--fg-2); }

/* ---------- 关键词屏蔽：分类 tab ----------
   一排胶囊，选中＝填充提亮；不带搜索框，分类就是筛选维度。 */
.kwbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  border-bottom: 0;
}

.kwtabs {
  display: flex;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* tab 行本身不要滚动条，横滑就够了 */
.kwtabs::-webkit-scrollbar { height: 0; }
.kwtabs { scrollbar-width: none; }

.kwtab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-full);
  background: var(--panel-2);
  color: var(--fg-3);
  font-size: 13px;
  white-space: nowrap;
  transition: color .12s, background .12s;
}

.kwtab:hover { color: var(--fg-2); background: var(--panel-3); }
.kwtab.on { color: var(--fg); background: var(--panel-3); }

.kwtab em {
  font-style: normal;
  font-size: var(--fs-xs);
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}

.kwtab.on em { color: var(--fg-2); }

.kwbar .ghost { flex: none; }

/* ---------- 关键词屏蔽：一卡一词的卡片流 ----------
   卡片 = 词条 + 分类小字 + × 删除；点卡片本体切启用 / 停用。
   停用态不隐藏，整体降透明 + 词条划线，一眼能看出「在库但没生效」。 */
.kwgrid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding: 2px;               /* 给卡片留出空间，避免 .sec overflow 裁掉 */
}

.kwcard {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  min-height: var(--h-ctl-xs);
  padding: 6px 8px 6px 12px;
  border: 0;
  border-radius: var(--r);
  background: var(--panel-2);
  font-size: 13px;
  line-height: 1.5;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background .12s, opacity .12s;
}

.kwcard:hover { background: var(--panel-3); }
.kwcard:focus-visible { outline: none; background: var(--panel-3); }

.kwcard-w {
  color: var(--fg);
  word-break: break-all;      /* 长词条 / 整句也能在卡内折行，不撑破容器 */
}

.kwcard-cat {
  font-size: var(--fs-xs);
  color: var(--fg-3);
  white-space: nowrap;
}

/* 今日命中次数：只在 >0 时才渲染，压暗一档，别抢词条本身的注意力 */
.kwcard-n {
  font-size: var(--fs-xs);
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* × 常显但压暗，hover 提亮；触屏没有 hover，所以不做成「hover 才出现」 */
.kwcard-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--r-sm);
  color: var(--fg-3);
  font-size: 13px;
  line-height: 1;
  opacity: .45;
  transition: color .12s, opacity .12s, background .12s;
}

.kwcard:hover .kwcard-x { opacity: 1; }
.kwcard-x:hover { color: var(--bad); background: var(--toast-bad-bg); }

/* 停用：整卡压暗 + 词条划线，但保留可点（点一下就启用回来） */
.kwcard.off { opacity: .45; }
.kwcard.off:hover { opacity: .8; }
.kwcard.off .kwcard-w { text-decoration: line-through; text-decoration-color: var(--fg-3); }

@media (max-width: 720px) {
  .kwcard { font-size: 12px; padding: 5px 6px 5px 10px; gap: 6px; }
  .kwgrid { gap: 6px; }
  .kwtab { font-size: 12px; padding: 0 11px; }
  /* 窄屏 tab 数多，藏计数（计数在右上角 n-words 里有）让 7 个分类一行放下 */
  .kwtab em { display: none; }
}

@media (max-width: 720px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .tools input { width: 100%; }
  .tools textarea { width: 100%; }
}

/* ---------- 注册 / 登录弹窗 ---------- */

.modal {
  position: absolute;   /* 跟着 .app 卡片走 */
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal[hidden] { display: none; }

.modal-mask {
  position: absolute;
  inset: 0;
  background: var(--mask);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: fade .16s ease;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: calc(100% - 32px);
  overflow-y: auto;
  padding: 24px var(--inset) 20px;
  border: 0;
  border-radius: var(--r-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
  animation: pop .18s cubic-bezier(.2, .8, .3, 1);
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(.99); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .modal-mask, .modal-card { animation: none; }
}

.modal-x {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  transition: background .15s;
}

.modal-x::before,
.modal-x::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 1.5px;
  border-radius: 1px;
  background: var(--fg-3);
  transition: background .15s;
}

.modal-x::before { transform: translate(-50%, -50%) rotate(45deg); }
.modal-x::after { transform: translate(-50%, -50%) rotate(-45deg); }
.modal-x:hover { background: var(--panel-3); }
.modal-x:hover::before, .modal-x:hover::after { background: var(--fg); }

/* ---------- 底部弹出层（离开确认） ---------- */

.sheet-wrap {
  position: absolute;   /* 跟着 .app 卡片走，与 .modal 一致 */
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
}

/* display:flex 会吃掉 hidden 的默认表现，必须显式压住 */
.sheet-wrap[hidden] { display: none; }

.sheet-mask {
  position: absolute;
  inset: 0;
  background: var(--mask);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: fadeIn .18s ease both;
}

.sheet {
  position: relative;
  width: 100%;
  padding: 12px var(--inset) calc(20px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: var(--panel);
  animation: sheetIn .24s cubic-bezier(.2, .8, .3, 1) both;
}

/* 顶部短横条：一眼看出是「从下面拉起来的面板」，也暗示可点遮罩收回 */
.sheet-grip {
  width: 36px;
  height: 4px;
  margin: 2px auto 16px;
  border-radius: 2px;
  background: var(--panel-3);
}

.sheet h2 { margin: 0 0 6px; font-size: var(--fs-base); font-weight: 500; }
.sheet p { margin: 0 0 18px; font-size: var(--fs-sm); line-height: 1.7; color: var(--fg-3); }

.sheet-acts { display: flex; gap: 8px; }
.sheet-acts .ghost { flex: 1; height: var(--h-ctl); font-size: var(--fs-base); border-radius: var(--r); }
/* 危险项：淡红填充面 + 红字，不用描边 */
.sheet-acts .danger { color: var(--bad); background: var(--danger-bg); }
.sheet-acts .danger:hover { color: var(--bad); background: var(--danger-bg-hover); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes sheetOut { from { transform: translateY(0); } to { transform: translateY(100%); } }

/* 收回：加 .closing 反向播，播完由 app.js 置 hidden（不能直接 hidden，否则没有过渡） */
.sheet-wrap.closing .sheet-mask { animation: fadeOut .18s ease both; }
.sheet-wrap.closing .sheet { animation: sheetOut .2s cubic-bezier(.4, 0, .7, 1) both; }

@media (prefers-reduced-motion: reduce) {
  .sheet-mask,
  .sheet,
  .sheet-wrap.closing .sheet-mask,
  .sheet-wrap.closing .sheet { animation: none; }
}


.auth-head { padding-right: 26px; }
.auth-head h2 { margin: 0 0 7px; font-size: var(--fs-lg); font-weight: 500; letter-spacing: .01em; }
.auth-head p { margin: 0 0 20px; font-size: 12px; line-height: 1.7; color: var(--fg-3); }

.modal-card .field { margin-bottom: 16px; }
.modal-card .field label { margin-bottom: 6px; }
.modal-card .field input { height: var(--h-ctl); }
/* 滑杆不跟文本框一起变高：气泡要贴着 thumb，42px 会把轨道推到中间、气泡离得老远 */
.modal-card .field input.age-range { height: 22px; }
.modal-card .hint { min-height: 14px; margin-top: 4px; }
.auth-submit { width: 100%; height: 44px; margin-top: 4px; }

.code-row { display: flex; gap: 8px; align-items: center; }
.code-row input { flex: 1; min-width: 0; }
.code-row .ghost { flex: none; height: var(--h-ctl); padding: 0 12px; }
.auth-consent .link { margin: 0; font-size: inherit; }
#login-setpass[hidden],
#login-pass-field[hidden],
#login-code-field[hidden],
#login-invite-field[hidden],
#p-phone[hidden] { display: none; }
.login-forgot { margin: 8px 0 0; text-align: right; }

/* 登录 / 注册走底部弹层。注册字段多，超出视口再滚，短表保持自然高度。 */
#login .sheet {
  margin: 0;
  max-height: min(88dvh, 640px);
  overflow-y: auto;
}
#login .sheet .field { margin-bottom: 14px; }
#login .sheet > p { margin-bottom: 16px; }
#login .auth-consent {
  margin: 10px 0 0;
  font-size: var(--fs-xs);
  line-height: 1.6;
  color: var(--fg-3);
  text-align: center;
}
#login .login-forgot { margin: 8px 0 0; text-align: right; }

/* 协议同意从首页勾选框挪到提交按钮下面一行小字：不再占首页版面，也仍然说清楚 */
.auth-consent {
  margin: 10px 0 0;
  font-size: var(--fs-xs);
  line-height: 1.6;
  color: var(--fg-3);
  text-align: center;
}

.auth-consent a {
  color: var(--fg-3);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--line-2);
  text-underline-offset: 2px;
}

.auth-consent a:hover { color: var(--fg-2); text-decoration-color: var(--fg-2); }

/* 协议勾选：登录 / 注册 / 找回密码提交前必须勾上。
   ⛔ 方框画在 <i> 上，不给 input 用 ::after —— input 是替换元素，伪元素在部分浏览器不渲染。
   input 本体 opacity:0 但保留在流里，键盘和读屏照样能操作。 */
.agree {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 12px;
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--fg-3);
  text-align: left;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.agree input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.agree-box {
  position: relative;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  transition: background .15s ease, border-color .15s ease;
}
.agree-box::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border-right: 1.6px solid var(--bg);
  border-bottom: 1.6px solid var(--bg);
  transform: rotate(42deg) scale(0);
  transition: transform .13s ease-out;
}
.agree:hover .agree-box { border-color: var(--fg-3); }
.agree input:checked + .agree-box { background: var(--fg); border-color: var(--fg); }
.agree input:checked + .agree-box::after { transform: rotate(42deg) scale(1); }
.agree input:focus-visible + .agree-box { outline: 2px solid var(--fg-3); outline-offset: 2px; }
.agree-txt { min-width: 0; }
.agree a {
  color: var(--fg-3);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--line-2);
  text-underline-offset: 2px;
}
.agree a:hover { color: var(--fg-2); text-decoration-color: var(--fg-2); }
/* 没勾就点提交：方框转红 + 左右晃一下，比只弹一行字更容易被看见 */
.agree.err,
.agree.err a { color: var(--bad); }
.agree.err .agree-box { border-color: var(--bad); }
.agree.err { animation: agree-nudge .24s ease-in-out 1; }
@keyframes agree-nudge {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}
@media (prefers-reduced-motion: reduce) {
  .agree.err { animation: none; }
}

/* ---------- 首页：匹配偏好 ---------- */

.seg.wide { gap: 8px; }
.seg.wide .ghost { flex: 1; height: var(--h-ctl); font-size: var(--fs-base); border-radius: var(--r); }
#home-pref.seg.wide { gap: 6px; }
#home-pref.seg.wide .ghost {
  min-width: 0;
  padding: 0 8px;
  font-size: var(--fs-md);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1.15;
  /* 系统按钮点击会画出矩形焦点框。选中只提亮填充。 */
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  box-shadow: none;
}
#home-pref .ghost:focus,
#home-pref .ghost:focus-visible,
#home-pref .ghost:active {
  outline: none;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}
#home-pref .pref-cost {
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}
#home-pref .ghost.sel .pref-cost { color: var(--fg-2); }
#home-pref .ghost:disabled .pref-cost { opacity: .7; }

/* 左右滑动切选项：整组轻微跟手（--drag 由 app.js 的 prefSwipe 写入），松手回弹。
   ⛔ touch-action: pan-y 只吃横向，竖向留给页面滚动，否则首页整页滑不动。 */
#home-pref {
  touch-action: pan-y;
  transform: translate3d(var(--drag, 0px), 0, 0);
  transition: transform .2s cubic-bezier(.2, .9, .25, 1);
  -webkit-user-select: none;
  user-select: none;
}
#home-pref.drag { transition: none; }

/* ---------- 公共聊天室 ---------- */

/* 大厅消息：别人的昵称写在气泡里面，自己的靠右不署名 */
.lmsg {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: max-content;
  max-width: 78%;
}

/* ⛔ .bubble 自带 max-width:78%，但 .lmsg 的宽度又由内容（bubble）决定，
   形成「宽度看内容、max-width 又按父级算」的循环 —— 短消息会被随机挤成两行
   （复现：「诊断消息A」5 个字只给了 72px）。外层 .lmsg 已限 78%，这里放开内层。 */
.lmsg .bubble { max-width: 100%; }

.lmsg.them { align-self: flex-start; }
.lmsg.mine { align-self: flex-end; }
.lmsg .lwho {
  margin: 0 2px 2px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--fg-2);
  white-space: nowrap;
}

/* ---------- 消息列表 / 会话 ---------- */

.msgpane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.pane-blank {
  margin: auto;
  font-size: 12px;
  color: var(--fg-3);
  text-align: center;
}

/*
 * 空列表别撑开：.dmlist 是 flex:1，空的时候会把整块剩余高度吃掉，
 * 空态提示被挤到面板最底部（看着像「没居中」）。没有会话时让它彻底不占位。
 */
.dmlist:empty { display: none; }

/* 空态：一句标题 + 一句解释 + 一个去处，别让新用户对着一片空白 */
.pane-blank .blank-t {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--fg-2);
}

.pane-blank .blank-s {
  margin: 0 auto 14px;
  max-width: 240px;
  line-height: 1.6;
}

.pane-blank .solid {
  height: 36px;
  padding: 0 18px;
  font-size: 13px;
}

/* 会话行：头像方块 + 名字/最后一条 + 时间/未读。行高固定，扫起来齐 */
.dmlist {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 0 16px;
}

.dmitem {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--r);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.dmitem:hover { background: var(--panel-2); }
.dmitem.on { background: var(--panel-3); }

.dmitem .dmav {
  flex: none;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 13px;
  color: var(--fg-2);
  background: var(--panel-2);
}

.dmitem .dmmain {
  flex: 1;
  min-width: 0;
  display: block;
}

.dmitem .dmtop {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dmitem .dmname {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  color: var(--fg);
}

/* 在线才点绿点：不加字，不占宽，一眼看得出在不在 */
.dmitem .dmon {
  flex: none;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ok, #3fa96a);
}

.dmitem .dmtime {
  flex: none;
  font-size: 11px;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}

.dmitem .dmlast {
  display: block;
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--fg-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 自己发的最后一条：前面加个「你：」，一眼分清谁在等回复 */
.dmitem .dmlast .mepre { color: var(--fg-3); }

.dmitem .dmbadge {
  flex: none;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--fg);
  color: var(--bg);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* 好感按钮三态：未点 / 已点等对方 / 已留下。用透明度区分，不靠换颜色吓人 */
#btn-like.sent {
  color: var(--fg-3);
  cursor: default;
}

#btn-like.done {
  color: var(--fg-3);
  cursor: default;
}

.dm-note {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 12px;
  line-height: 1.6;
  color: var(--fg-3);
  text-align: center;
}

/* ---------- 应用外壳：手机全屏，桌面居中卡片 ---------- */

.app {
  position: relative;          /* toast / modal 的定位基准 */
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: none;
}

/* 卡片里这份 wrap 交给 flex 撑满，不再自己声明整屏高度。
   宽度跟卡片走：再留 max-width 会在手机上被 margin:auto 收成内容宽度，两侧空出一块。 */
.app > .wrap {
  width: 100%;
  max-width: none;
  height: auto;
  flex: 1;
  min-width: 0;
  min-height: 0;
  margin: 0;
  align-self: stretch;
}

/* 底栏：跟应用卡片走，不盖住上面的内容；不参与内容区滚动 */
.tabbar {
  flex: none;
  display: flex;
  align-items: stretch;
  height: calc(64px + env(safe-area-inset-bottom));
  padding: 6px 4px env(safe-area-inset-bottom);
  background: var(--bg);
  border-top: 0;
  position: relative;
  z-index: 6;
  touch-action: manipulation;
}
.tabbar[hidden] { display: none; }

.tab {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--fg-2);
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  box-shadow: none;
}
.tab:focus,
.tab:focus-visible,
.tab:active {
  outline: none;
  box-shadow: none;
  background: transparent;
}
.tab .tlabel {
  font-size: 12px;
  line-height: 1.2;
  font-weight: 500;
  color: inherit;
}
.tab .ticon {
  position: relative;
  width: 44px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: transparent;
  transition: background 120ms ease, color 120ms ease;
}
.tab .tdot {
  position: absolute;
  top: 4px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bad);
  box-shadow: 0 0 0 2px var(--bg);
  pointer-events: none;
}
.tab .tdot[hidden] { display: none; }
.tab svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab.on { color: var(--fg); }
.tab.on .ticon { background: var(--panel-3); }
html[data-theme="day"] .tab.on .ticon { background: var(--panel-2); }
.tab:hover { color: var(--fg-2); }
.tab.on:hover { color: var(--fg); }
.tab:active { color: var(--fg); }

#share-guest[hidden],
#share-in[hidden] { display: none; }

body.shell .toast {
  bottom: calc(80px + env(safe-area-inset-bottom));
}
body.shell.tab-off .toast {
  bottom: calc(28px + env(safe-area-inset-bottom));
}

@media (min-width: 901px) {
  body.shell {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow: hidden;
    background: var(--bg-out);
  }

  body.shell .app {
    width: 100%;
    max-width: 820px;
    height: calc(100vh - 48px);
    height: calc(100dvh - 48px);
    max-height: 800px;
    border: 0;
    border-radius: var(--r-xl);
    background: var(--bg);
    box-shadow: var(--shadow-card);
  }

  /* 宽屏下方是同一套单栏布局：消息列表整行铺开，行内容左对齐 */
}

/* ---------- 条款 / 隐私页 ---------- */

.doc {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 0 48px;
}

.doc h1 {
  margin: 20px 0 6px;
  font-size: var(--fs-lg);
  font-weight: 500;
}

.doc .doc-sub {
  margin: 0 0 26px;
  font-size: 12px;
  color: var(--fg-3);
}

.doc h2 {
  margin: 26px 0 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
}

.doc p,
.doc li {
  font-size: 13px;
  line-height: 1.75;
  color: var(--fg-2);
}

.doc p { margin: 8px 0; }
.doc ul { margin: 8px 0; padding-left: 18px; }
.doc li { margin: 4px 0; }
.doc b { color: var(--fg); font-weight: 500; }

.doc .doc-back { margin: 0 0 18px; }

/* ---------- 首页页脚（协议入口 + 备案号） ---------- */

.foot {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 14px;
  padding: 14px 0 18px;
  font-size: 11px;
  color: var(--fg-3);
  border-top: 1px solid var(--line);
}

.foot a {
  color: var(--fg-3);
  text-decoration: none;
}

.foot a:hover { color: var(--fg-2); }
.foot .sep { color: var(--line-2); }
.foot [hidden] { display: none; }
.foot[hidden] { display: none; }   /* ⛔ display:flex 会盖掉 hidden 属性，必须显式 */


@media (max-width: 720px) {
  /* 管理后台表格在窄屏改为横向滚动（单行排开后 .admin .sec 基础规则已覆盖），只留最小宽度兜底 */
  .sec table { min-width: 560px; }
  .tokenbar { flex-wrap: wrap; }
  .tokenbar input { flex: 1; min-width: 0; width: auto; }
}

/* ---------- 手机端表单适配 ---------- */

@media (max-width: 900px) {
  /* ⛔ iOS Safari：输入框字号 < 16px 时聚焦会强制放大页面。手机端输入类一律 16px */
  input:not([type="range"]):not([type="checkbox"]),
  textarea,
  select {
    font-size: 16px;
  }

  /* 首页：文字放大提亮做主角，次级控件收敛，CTA 保持唯一主按钮 */
  .hero { padding-bottom: 10px; }
  .hero h1 { font-size: 33px; line-height: 1.24; letter-spacing: -.02em; }
  .hero-bottom { margin-top: 24px; gap: 9px; }
  .start { height: 48px; font-size: 15px; }

  /* 注册弹窗收紧节奏，844 高内放下全部字段，不出滚动条 */
  .modal { padding: 16px; }
  .modal-card {
    max-height: calc(100% - 16px);
    padding: 22px var(--inset) 18px;
  }
  .auth-head p { margin-bottom: 14px; }
  #auth-form .field { margin-bottom: 16px; }
  #auth-form .hint { margin-top: 4px; }
  .agescale { display: none; }   /* 滑块两端的 18/99 刻度在手机上省掉 */

}

/* ==========================================================================
   后台 · 表格容器 + 数据库面板
   本块由后台改版引入，用的都是 v2 变量（--r / --panel / --line），
   位置可自由挪动或与 v2 的同类规则合并，合并时以 v2 的为准。
   ========================================================================== */

/* ---------- 表格容器 ----------
   ⛔ 横滚必须由 .twrap 单独承担：写在 .admin .sec 上会让标题 / 工具栏 / 空态一起跟着滚。
   ⛔ 表头吸顶要求 sticky 的滚动祖先就是它自己 —— 所以 .twrap 同时管纵滚 + 横滚，
      并给 max-height（超出才滚，短表保持自然高度）。
   全站滚动条默认藏掉；表格宽或高超出容器时，单独把滚动条露出来。 */
.twrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 12px;
  overflow: auto;
  max-height: min(56vh, 620px);
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll) transparent;
  -ms-overflow-style: auto;
}

.dbv-list {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll) transparent;
  -ms-overflow-style: auto;
}

.twrap::-webkit-scrollbar,
.dbv-list::-webkit-scrollbar {
  display: block;
  -webkit-appearance: none;
  width: 8px;
  height: 8px;
}

.twrap::-webkit-scrollbar-thumb,
.dbv-list::-webkit-scrollbar-thumb {
  background: var(--scroll);
  border-radius: var(--r-full);
}

.twrap::-webkit-scrollbar-thumb:hover,
.dbv-list::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-hover);
}

.twrap::-webkit-scrollbar-track,
.dbv-list::-webkit-scrollbar-track,
.twrap::-webkit-scrollbar-corner,
.dbv-list::-webkit-scrollbar-corner {
  background: transparent;
}

/* 列宽够放下时铺满容器；列总宽超出时表格变宽，由 .twrap 出横向滚动条 */
.admin .twrap > table,
.dbv-list > table {
  width: max-content;
  min-width: 100%;
}

/* ⛔ border-collapse: collapse 时 sticky 表头的边框会整条消失（Chrome/Safari 通病），
   后台表格统一改 separate —— 边框画在单元格自身，逐格 1px 不会叠成 2px。 */
.admin table { border-collapse: separate; border-spacing: 0; }

.admin thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
  border-bottom: 0;
  box-shadow: inset 0 -1px 0 var(--line);
}

/* 行 hover：表格唯一的悬停反馈，压到刚能察觉，不抢操作按钮 */
.admin tbody tr { transition: background .12s; }
.admin tbody tr:hover { background: var(--wash); }

/* 同一格里并排的按钮（封号 / 下线 / 删号、聊天室成员 ×）：两两留 6px，别粘成一排 */
.admin td .ghost + .ghost { margin-left: 6px; }

/* 空态：给一个和卡片同口径的容器，「没数据」才不会被看成「没加载出来」 */
.admin .sec > .row-empty {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
}

/* ⛔ 空态一显示，整张表（连表头一起）收掉 —— 空表还挂一行表头，看着像加载失败。
   依赖 HTML 里 .row-empty 排在 .twrap / .kwgrid 之前，用兄弟选择器联动，不用改 JS。 */
.admin .row-empty:not([hidden]) ~ .twrap,
.admin .row-empty:not([hidden]) ~ .kwgrid { display: none; }

/* ---------- 数据库面板 ---------- */

/* 连接状态条：四块平铺，第一块是存储模式，别做成一行挤在一起的纯文字 */
.dbstat {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.dbstat-i {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  font-size: 12px;
}

.dbstat-mode { color: var(--ok); font-weight: 500; }

/* ---------- 数据库下钻弹窗（列多，卡片要比消息弹窗宽一截） ---------- */

.dbv-card { max-width: min(1080px, 100%); }

.dbv-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0;
}

/* 弹窗底是卡片色，表头吸顶必须用同一个底色，不能用页面底色 */
.dbv-list table { border-collapse: separate; border-spacing: 0; }

.dbv-list thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
  border-bottom: 0;
  box-shadow: inset 0 -1px 0 var(--line);
}

/* 单格最多 320px：长 uuid / 长文本截断，完整值在 title 里 */
.dbv-list td {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 首页：黑夜 / 白天 ----------
   只换 html[data-theme] 上的颜色变量，不另做一套页面。 */
.themebar {
  position: relative;
  flex: none;
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 8px 0 0;
  padding: 3px;
  border-radius: var(--r-full);
  background: var(--panel);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  cursor: pointer;
}
.themebar.dragging { cursor: grabbing; }

/* 选中底跟着黑夜 / 白天滑过去，页面颜色本身不参与过渡。
   滑块只比轨道轻轻抬一档，不要亮白块或近黑块。 */
.theme-knob {
  position: absolute;
  z-index: 0;
  top: 3px;
  left: 3px;
  width: 36px;
  height: 32px;
  border-radius: var(--r-full);
  background: #3A3D4C;
  pointer-events: none;
  transform: translateX(0);
  transition: transform 220ms ease-out;
  will-change: transform;
}
html[data-theme="day"] .theme-knob { background: #E4E4EA; }
html[data-theme-mode="system"] .theme-knob { transform: translateX(calc(100% + 2px)); }
html[data-theme-mode="day"] .theme-knob { transform: translateX(calc(200% + 4px)); }
.themebar.dragging .theme-knob { transition: none; }

.themebar button {
  position: relative;
  z-index: 1;
  width: 36px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--fg-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  cursor: inherit;
}
.themebar button:focus-visible {
  outline: none;
  color: var(--fg);
}

.themebar button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.themebar .theme-half { fill: currentColor; stroke: none; }

.themebar button.on {
  background: transparent;
  color: #C6C7CE;
}
html[data-theme="day"] .themebar button.on { color: #3A3C44; }

@media (prefers-reduced-motion: reduce) {
  .theme-knob { transition: none; }
  .view.slide-in.from-right,
  .view.slide-in.from-left { animation: view-fade 140ms ease-out both; }
  .view.slide-out.to-left,
  .view.slide-out.to-right { animation: view-fade-out 140ms ease-out both; }
}

.themebar button:hover { color: #C6C7CE; }
html[data-theme="day"] .themebar button:hover { color: #3A3C44; }

/* ---------- 我的 ----------
   横向上沿用 .wrap 的 20px。这一页自己滚，底栏在外面，不盖住退出 / 注销。 */

[data-view="profile"] { overflow: hidden; }

.me {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 0 20px;
}
#profile-guest[hidden],
#profile-in[hidden] { display: none; }

.me-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  padding: 24px 8px 40px;
}
.me-empty-t {
  margin: 10px 0 0;
  font-size: 18px;
  font-weight: 500;
  color: var(--fg);
}
.me-empty-s {
  margin: 0;
  max-width: 240px;
  font-size: var(--fs-md);
  line-height: 1.6;
  color: var(--fg-3);
}
.me-empty .solid {
  margin-top: 14px;
  min-width: 132px;
  height: var(--h-ctl);
}

.me-id {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border-radius: var(--r-lg);
  background: var(--panel);
}
.me-avatar {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
}
.me-avatar svg,
.me-person {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.me-avatar.has-initial .me-person { display: none; }
.me-avatar:not(.has-initial) .me-initial { display: none; }
.me-id-txt { flex: 1; min-width: 0; }
.me-nick {
  font-size: var(--fs-lg);
  font-weight: 500;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.me-phone {
  margin-top: 2px;
  font-size: var(--fs-md);
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.me-phone[hidden] { display: none; }
.me-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.me-chip {
  padding: 3px 10px;
  border-radius: var(--r-full);
  background: var(--panel-2);
  color: var(--fg-2);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.me-id-acts {
  flex: none;
  display: flex;
  gap: 6px;
}
.me-id-acts .ibtn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.me-points {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 12px 16px;
  border-radius: var(--r-lg);
  background: var(--panel);
}
.me-points-n { display: flex; flex-direction: column; gap: 2px; }
.me-points-acts { display: flex; align-items: center; gap: 8px; flex: none; }
.orders-empty { margin: 8px 0 0; color: var(--fg-2); }
.orders-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.me-points span { font-size: var(--fs-base); font-weight: 500; color: var(--fg); }
.me-points b {
  font-size: 22px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

.me-tasks {
  display: flex;
  flex-direction: column;
  margin-top: 10px;
  border-radius: var(--r-lg);
  background: var(--panel);
}
.me-tasks[hidden] { display: none; }
.me-tasks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  margin: 0;
  padding: 12px 16px;
  border: 0;
  border-radius: var(--r-lg);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.me-tasks-n { display: flex; flex-direction: column; gap: 2px; }
.me-tasks-go {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--h-ctl-xs);
  height: var(--h-ctl-xs);
  padding: 0;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  color: var(--fg-2);
  line-height: 1;
}
.me-tasks-head:hover .me-tasks-go,
.me-tasks-head[aria-expanded="true"] .me-tasks-go {
  color: var(--fg);
  background: var(--panel-3);
}
.me-tasks-chev {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .15s ease;
}
.me-tasks-head[aria-expanded="true"] .me-tasks-chev { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) {
  .me-tasks-chev { transition: none; }
}
.me-tasks-body { padding: 0 16px 12px; }
.me-tasks-body[hidden] { display: none; }
#task-need-phone[hidden] { display: none; }
.me-tasks-n span {
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--fg);
}
.me-tasks-n b {
  font-size: 22px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.task-need-phone,
.task-foot {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--fg-3);
}
.task-need-phone { margin-bottom: 4px; }
.task-foot { margin-top: 6px; }

.checkin-cal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 12px;
}
.checkin-cal-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
#checkin-month {
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--fg);
}
.checkin-streak {
  font-size: var(--fs-sm);
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}
.checkin-cal {
  margin: 0;
  padding: 0;
  background: none;
}
.checkin-week,
.checkin-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px 2px;
}
.checkin-week {
  margin-bottom: 6px;
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
  padding: 2px 0;
}
.checkin-week span {
  text-align: center;
  font-size: 12px;
  color: var(--fg-3);
  line-height: 1.2;
}
.checkin-scroll {
  max-height: min(52vh, 360px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px 4px;
}
.checkin-month-label {
  grid-column: 1 / -1;
  margin: 10px 0 2px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--fg-2);
}
.checkin-month-label:first-child { margin-top: 0; }
.checkin-cell {
  width: 44px;
  height: 44px;
  justify-self: center;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--fg-2);
  font: inherit;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.checkin-cell.out { visibility: hidden; }
.checkin-cell .d { font-weight: 500; font-size: 15px; }
.checkin-cell .b {
  font-size: 10px;
  font-weight: 500;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.checkin-cell.done {
  box-shadow: inset 0 0 0 1.5px var(--ok);
  color: #fff;
  background: var(--ok);
}
.checkin-cell.done .d { font-weight: 600; color: #fff; }
.checkin-cell.done .b { color: #fff; }
.checkin-cell.today:not(.done) {
  box-shadow: inset 0 0 0 1.5px var(--fg-3);
}
.checkin-cell.today .d { color: var(--fg); }
.checkin-cell.today.can { cursor: pointer; }
.checkin-cell.today.can .d { color: var(--ok); }
.checkin-cell.future-pts .b { color: var(--fg-3); }
.checkin-cell.future-bonus .b { color: var(--ok); }
.checkin-hint {
  margin: 12px 0 0;
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--fg-3);
}
.checkin-rewards {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.checkin-rewards[hidden] { display: none; }
.checkin-reward {
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}
.checkin-reward b {
  font-weight: 500;
  color: var(--ok);
}
.checkin-weekend-note {
  margin-top: 2px;
  color: var(--fg-3);
}
.task-list { display: flex; flex-direction: column; }
.task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 6px 0;
}
.task-name {
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--fg);
}
.task-pts {
  margin-top: 2px;
  font-size: var(--fs-sm);
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}
.task-acts {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.task-row .ghost { flex: none; min-width: 64px; }

.me-invite {
  margin-top: 10px;
  padding: 14px 14px 12px;
  border-radius: var(--r-lg);
  background: var(--panel);
}
.me-invite-k {
  margin-bottom: 6px;
  font-size: var(--fs-base);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--fg);
}
.me-invite-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.me-code {
  flex: 1;
  min-width: 0;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: .06em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.me-invite-note { padding: 8px 2px 0; }
.me-sets { margin: 0; }
.me-sets .setrow { min-height: 48px; }

/* 版本号：滚到内容最底下，短页面贴在底栏上方。纯文字，不是按钮。 */
.me-ver {
  flex: none;
  margin: 0;
  padding: 4px 0 0;
  text-align: center;
  font-size: var(--fs-xs);
  line-height: 1.4;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  color: var(--fg-3);
}
#profile-in > .me-ver { margin-top: auto; padding-top: 28px; }
.me-ver[hidden] { display: none; }

.me-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 28px;
}
.me-logout {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--panel);
  color: var(--fg);
  font-size: var(--fs-base);
}
.me-logout:hover { background: var(--panel-2); }
.me-foot .link { margin: 0; font-size: var(--fs-md); }
.set-delete {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 8px 0 2px;
  border: 0;
  background: none;
  color: var(--fg-3);
  font-size: var(--fs-sm);
}
.set-delete:hover { color: var(--fg-2); }
.pack-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.pack { width: 100%; }
.pack.sel,
.pack.sel:hover { background: var(--panel-3); color: var(--fg); }
.pay-channels { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.pay-ch { width: 100%; }
.pay-ch.sel,
.pay-ch.sel:hover { background: var(--panel-3); color: var(--fg); }
#btn-recharge-ok,
#btn-recharge-web { width: 100%; margin-top: 18px; }
#btn-recharge-ok:disabled:hover { background: var(--solid); }
.order-row {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px; border-radius: var(--r); background: var(--panel-2);
}
.order-row .ord-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.order-row .ord-meta { color: var(--fg-2); font-size: 12px; }
.order-row .ord-paid { color: var(--ok, #2a7a4b); }
.order-row .ord-pending { color: var(--fg-2); }
.order-row .ord-closed { color: var(--fg-3, var(--fg-2)); }
.edit-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.edit-actions .ghost {
  width: 100%;
  height: var(--h-ctl);
  justify-content: center;
}
#phone-rebind .sheet .field,
#pass-change .sheet .field { margin-bottom: 14px; }
#phone-rebind .sheet .field:last-of-type,
#pass-change .sheet .field:last-of-type { margin-bottom: 8px; }
#p-rebind-ok,
#p-pass-ok {
  width: 100%;
  margin-top: 10px;
}

/* ---------- 分享 ---------- */
.feed {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 0 0;
}
.feed-top {
  flex: none;
  display: flex;
  align-items: center;
  padding: 0 0 12px;
}
.feed-top .feed-seg {
  width: auto;
  align-items: center;
  gap: 0;
  height: 32px;
  padding: 2px;
  border-radius: var(--r-full);
  background: var(--panel-2);
}
.feed-top .feed-seg .ghost {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  margin: 0;
  padding: 0 14px;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--fg-2);
  font-size: 13px;
  line-height: 1;
  box-shadow: none;
}
.feed-top .feed-seg .ghost:hover {
  background: transparent;
  color: var(--fg);
}
.feed-top .feed-seg .ghost.sel,
.feed-top .feed-seg .ghost.sel:hover {
  background: var(--panel-3);
  color: var(--fg);
}
html[data-theme="day"] .feed-top .feed-seg .ghost.sel,
html[data-theme="day"] .feed-top .feed-seg .ghost.sel:hover {
  background: var(--panel);
}
.feed-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* 右下角加号浮在列表上，滚到底时最后一条正文还能露出来 */
  padding: 0 0 96px;
}
.feed-fab {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  width: 60px;
  height: 60px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--r-full);
  appearance: none;
  background: var(--panel-3);
  color: var(--fg);
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.feed-fab svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
}
.feed-fab:hover,
.feed-fab:focus-visible {
  background: var(--panel-3);
  color: var(--fg);
  box-shadow: none;
}
.feed-fab:active { transform: scale(.96); }
#feedpost .sheet {
  max-height: min(86dvh, 560px);
  overflow-y: auto;
}
.feed-card {
  flex: none;
  background: var(--panel);
  border-radius: var(--r-lg);
  padding: 14px 16px 10px;
}
.feed-who {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.feed-who b {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.feed-who time {
  margin-left: auto;
  flex: none;
  font-size: 11px;
  color: var(--fg-3);
}
.feed-lock {
  margin: 10px 0 0;
  padding: 18px 12px;
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--fg-2);
  font-size: var(--fs-md);
  text-align: center;
}
.feed-text {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.feed-imgs {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}
.feed-imgs.n2,
.feed-imgs.n3,
.feed-imgs.n4 { grid-template-columns: 1fr 1fr; }
.feed-imgs img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: var(--r);
  background: var(--panel-2);
  display: block;
}
.feed-imgs.n1 img {
  height: auto;
  max-height: 320px;
  object-fit: contain;
}
.feed-acts { display: flex; align-items: center; gap: 2px; margin-top: 6px; }
.feed-act {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 8px 0 4px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--fg-3);
}
.feed-act svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.feed-act .n { font-size: 12px; font-variant-numeric: tabular-nums; }
.feed-act.on { color: var(--bad); }
.feed-act.on svg { fill: currentColor; }
.feed-act:hover { color: var(--fg); background: var(--panel-2); }
.feed-act.on:hover { color: var(--bad); }
.feed-thread { margin-top: 4px; display: flex; flex-direction: column; gap: 8px; }
.feed-thread[hidden] { display: none; }
.feed-c { font-size: 13px; line-height: 1.55; color: var(--fg); word-break: break-word; }
.feed-c b { font-weight: 500; margin-right: 6px; }
.feed-c time { color: var(--fg-3); font-size: 11px; margin-left: 6px; }
.feed-reply { display: flex; gap: 8px; align-items: center; }
.feed-reply input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--fg);
  outline: none;
}
.feed-reply input:focus { background: var(--panel-3); }
.feed-compose { display: flex; flex-direction: column; gap: 10px; }
.feed-compose[hidden],
.feed-login[hidden],
.feed-prevs[hidden],
#invite-box[hidden] { display: none; }
.feed-compose textarea {
  width: 100%;
  min-height: 72px;
  max-height: 140px;
  resize: none;
  border: 0;
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--fg);
  padding: 10px 14px;
  outline: none;
  line-height: 1.55;
}
.feed-compose textarea:focus { background: var(--panel-3); }
.feed-compose textarea::placeholder { color: var(--fg-3); }
.feed-row { display: flex; align-items: center; gap: 8px; }
.feed-row .solid { flex: none; height: var(--h-ctl); padding: 0 18px; }
.feed-hint {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--bad);
}
.feed-login {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.feed-login p { margin: 0; font-size: 13px; color: var(--fg-2); }
.feed-login .solid { height: 36px; padding: 0 16px; flex: none; }
.feed-prevs { display: flex; flex-wrap: wrap; gap: 8px; }
.feed-prev {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--panel-2);
}
.feed-prev img { width: 100%; height: 100%; object-fit: cover; display: block; }
.feed-x {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: var(--r-full);
  background: var(--panel);
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.feed-x svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.feed-list .empty { padding: 28px 8px; }

@media (max-width: 420px) {
  .feed-login { align-items: stretch; flex-direction: column; }
  .feed-login .solid { width: 100%; }
}
