/* worldlines · 对话列表页（精美版）
   会话 = 我对某个世界的存档。列为主语：作品 + 最后一句。
   颜色契约：紫(--accent-rgb) = 内容 · 粉(--accent-2-rgb) = 人 + 时效。
   交互：置顶(手动 pin 优先/无 pin 取最近) · 搜索即时过滤
        行菜单(置顶/删除) · 删除确认浮层 · 点行跳 play.html */


/* ─────────── 容器 · 氛围层 ─────────── */

.chats-page {
  position: relative;
  max-width: var(--max-w, 1280px);
  margin: 0 auto;
  padding: 40px var(--pad-x, 32px) 32px;
  min-height: 60vh;
}

/* 左侧贯穿细线 · 主题色极低透明度 · 上下淡出 */
.ch-rail {
  position: absolute;
  left: calc(var(--pad-x, 32px) - 14px);
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(var(--accent-rgb), 0.10) 10%,
    rgba(var(--accent-rgb), 0.16) 50%,
    rgba(var(--accent-rgb), 0.10) 90%,
    transparent 100%
  );
  pointer-events: none;
}


/* ─────────── 页头：标尺 + display 大字 + 数据副标 ─────────── */

.ch-head {
  position: relative;
  margin-bottom: 32px;
}
.ch-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.14em;
  color: var(--fg-3);
}
.ch-eyebrow-mark {
  color: rgb(var(--accent-2-rgb));
  font-weight: 700;
}
.ch-eyebrow-line {
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: 0.4;
}
.ch-eyebrow-label { opacity: 0.7; }
.ch-eyebrow-spacer { flex: 1; }

.ch-title {
  font-family: var(--font-display);
  font-size: clamp(40px, 5.5vw, 64px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--fg);
  margin: 0 0 16px;
}
.ch-sub {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  color: var(--fg-3);
  margin: 0;
}
.ch-sub b {
  color: rgb(var(--accent-2-rgb));
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}


/* ─────────── 搜索：eyebrow 右侧的小胶囊按钮 · 点击展开 ─────────── */

.ch-search {
  position: relative;
  display: flex;
  align-items: center;
}
.ch-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill, 999px);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.06em;
  color: var(--fg-3);
  cursor: pointer;
  transition: color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.ch-search-btn:hover {
  color: var(--fg-2);
  border-color: var(--line-strong);
  background: var(--surface-hover);
}
.ch-search-btn svg {
  width: 13px;
  height: 13px;
}
.ch-search-btn kbd {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  font-size: var(--text-2xs);
  color: var(--fg-3);
  background: transparent;
  letter-spacing: 0;
}
.ch-search-input {
  display: none;
  width: 280px;
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid rgba(var(--accent-rgb), 0.45);
  border-radius: var(--r-pill, 999px);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--fg);
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1);
}
.ch-search-input::placeholder { color: var(--fg-3); }
.ch-search.is-open .ch-search-btn { display: none; }
.ch-search.is-open .ch-search-input { display: block; }


/* ─────────── 区标签：主世界 ─────────── */

.ch-hero-sec {
  margin-bottom: 44px;
}
.ch-hero-sec[hidden] { display: none; }
.ch-hero-sec-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.14em;
  color: var(--fg-3);
}
.ch-hero-sec-mark {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgb(var(--accent-2-rgb));
  box-shadow: 0 0 12px rgba(var(--accent-2-rgb), 0.5);
  animation: ch-markPulse 2.4s ease-in-out infinite;
}
@keyframes ch-markPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.85); }
}
.ch-hero-sec-hint {
  margin-left: auto;
  opacity: 0.5;
  letter-spacing: 0.18em;
}


/* ─────────── Hero 卡：cover 当背景 + 渐变压暗 + 衬线引文 + CTA ─────────── */

.ch-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 320px;
  border-radius: var(--r-card, 16px);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .3s var(--ease), transform .3s var(--ease), box-shadow .3s var(--ease);
  isolation: isolate;
}
.ch-hero:hover {
  border-color: rgba(var(--accent-rgb), 0.45);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.32);
}

.ch-hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.ch-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  filter: brightness(0.5) saturate(1.1);
  transition: transform .9s var(--ease), filter .5s var(--ease);
}
.ch-hero:hover .ch-hero-img {
  transform: scale(1.06);
  filter: brightness(0.58) saturate(1.18);
}
.ch-hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(105deg,
      rgba(0, 0, 0, 0.88) 0%,
      rgba(0, 0, 0, 0.72) 38%,
      rgba(0, 0, 0, 0.4) 65%,
      rgba(0, 0, 0, 0.18) 100%),
    linear-gradient(to bottom,
      transparent 45%,
      rgba(0, 0, 0, 0.6) 100%);
}

.ch-hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 30px 34px 26px;
  max-width: 68%;
}

.ch-hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.7);
}
.ch-hero-eyebrow .ch-hero-prog {
  color: rgb(var(--accent-rgb));
  font-weight: 600;
}
.ch-hero-eyebrow .ch-hero-time { color: rgba(255, 255, 255, 0.8); }
.ch-hero-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}
.ch-hero-dot.is-on {
  width: 6px;
  height: 6px;
  background: rgb(var(--accent-2-rgb));
  box-shadow: 0 0 10px rgba(var(--accent-2-rgb), 0.6);
  opacity: 1;
  animation: ch-markPulse 2.4s ease-in-out infinite;
}
.ch-hero-unread-text {
  color: rgb(var(--accent-2-rgb));
  font-weight: 600;
  letter-spacing: 0.14em;
}

.ch-hero-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 2.8vw, 36px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: #fff;
  margin: 0 0 16px;
}

.ch-hero-quote {
  font-family: 'Noto Serif SC', 'Noto Sans SC', serif;
  font-size: clamp(15px, 1.3vw, 19px);
  font-weight: 400;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.94);
  margin: 0;
  padding-left: 18px;
  position: relative;
  max-width: 540px;
}
.ch-hero-quote::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: rgb(var(--accent-2-rgb));
  border-radius: 1px;
  opacity: 0.9;
}
.ch-hero-quote .ch-hero-quote-speaker {
  display: block;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
}

.ch-hero-foot {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: auto;
  padding-top: 20px;
}
.ch-hero-chars {
  display: flex;
  align-items: center;
}
.ch-hero-char {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(0, 0, 0, 0.45);
  margin-left: -8px;
  transition: transform .3s var(--ease);
}
.ch-hero-char:first-child { margin-left: 0; }
.ch-hero:hover .ch-hero-char { transform: translateX(2px); }

.ch-hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 11px 20px 11px 22px;
  background: rgb(var(--accent-2-rgb));
  color: #fff;
  border: none;
  border-radius: var(--r-pill, 999px);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(var(--accent-2-rgb), 0.35);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.ch-hero-cta:hover {
  transform: translateX(2px);
  box-shadow: 0 6px 28px rgba(var(--accent-2-rgb), 0.55);
}
.ch-hero-cta svg {
  width: 14px;
  height: 14px;
  transition: transform .2s var(--ease);
}
.ch-hero-cta:hover svg { transform: translateX(3px); }


/* ─────────── 列表分组 ─────────── */

.ch-list-sec { position: relative; }

.ch-group {
  margin-bottom: 40px;
}
.ch-group:last-child { margin-bottom: 0; }

.ch-group-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.16em;
  color: var(--fg-3);
}
.ch-group-label {
  color: var(--fg-2);
  font-weight: 600;
}
.ch-group-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--line) 0%, transparent 80%);
}
.ch-group-count {
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}


/* ─────────── 行卡：cover-信息-角色头像 三栏 ─────────── */

.ch-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ch-row {
  position: relative;
  display: grid;
  grid-template-columns: 54px 64px 1fr 56px 22px;
  align-items: center;
  gap: 18px;
  padding: 14px 18px 14px 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md, 12px);
  background: transparent;
  cursor: pointer;
  transition: background .25s var(--ease), border-color .25s var(--ease), transform .25s var(--ease);
}
/* 时间侧标 · 24h 内亮粉（=人/时效） */
.ch-row::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 16px;
  bottom: 16px;
  width: 2px;
  background: transparent;
  border-radius: 1px;
  transition: background .25s var(--ease), box-shadow .25s var(--ease);
}
.ch-row.is-recent::before {
  background: rgb(var(--accent-2-rgb));
  box-shadow: 0 0 10px rgba(var(--accent-2-rgb), 0.5);
}
.ch-row:hover {
  background: var(--surface-hover);
  border-color: rgba(var(--accent-rgb), 0.3);
  transform: translateX(2px);
}

.ch-row-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 4px;
  font-family: var(--font-mono);
  color: var(--fg-3);
  text-align: center;
  line-height: 1;
}
.ch-row-time-num {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--fg-2);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.ch-row-time-unit {
  margin-top: 4px;
  font-size: var(--text-3xs);
  letter-spacing: 0.08em;
  opacity: 0.7;
}
.ch-row-time-day {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-2);
  letter-spacing: 0.04em;
}
.ch-row-time-date {
  font-size: var(--text-2xs);
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
  margin-top: 3px;
  opacity: 0.85;
}
.ch-row.is-recent .ch-row-time-num,
.ch-row.is-recent .ch-row-time-day {
  color: rgb(var(--accent-2-rgb));
}

.ch-row-cover {
  width: 64px;
  height: 64px;
  border-radius: var(--r-sm, 6px);
  object-fit: cover;
  border: 1px solid var(--line);
  transition: transform .35s var(--ease), border-color .35s var(--ease);
}
.ch-row:hover .ch-row-cover {
  transform: scale(1.04);
  border-color: rgba(var(--accent-rgb), 0.45);
}

.ch-row-main {
  min-width: 0;
}
.ch-row-title {
  font-family: var(--font-display);
  font-size: var(--text-card-name, 16.5px);
  font-weight: 600;
  color: var(--fg);
  margin: 0 0 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.005em;
}
.ch-row-quote {
  font-family: 'Noto Serif SC', 'Noto Sans SC', serif;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--fg-2);
  margin: 0 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ch-row-quote-speaker {
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  margin-right: 6px;
  letter-spacing: 0.04em;
}
.ch-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.04em;
  color: var(--fg-3);
}
.ch-row-prog { color: rgb(var(--accent-rgb)); font-weight: 500; }
.ch-row-sep {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
}
.ch-row-unread {
  display: inline-grid;
  place-items: center;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgb(var(--accent-2-rgb));
  box-shadow: 0 0 8px rgba(var(--accent-2-rgb), 0.6);
  flex: 0 0 auto;
}

.ch-row-portrait {
  position: relative;
  width: 56px;
  height: 56px;
}
.ch-row-portrait-img {
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--line);
  transition: transform .35s var(--ease), border-color .35s var(--ease), box-shadow .35s var(--ease);
}
.ch-row:hover .ch-row-portrait-img {
  border-color: rgba(var(--accent-2-rgb), 0.7);
  box-shadow: 0 4px 14px rgba(var(--accent-2-rgb), 0.25);
}
.ch-row-portrait-img:nth-child(1) { left: 0; top: 0; z-index: 1; }
.ch-row-portrait-img:nth-child(2) { left: 18px; top: 0; z-index: 2; }
.ch-row-portrait-img:nth-child(3) { left: 36px; top: 0; z-index: 1; }
.ch-row:hover .ch-row-portrait-img:nth-child(1) { transform: translateX(-4px); }
.ch-row:hover .ch-row-portrait-img:nth-child(3) { transform: translateX(4px); }

.ch-row-more {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--fg-3);
  cursor: pointer;
  opacity: 0;
  transition: opacity .2s var(--ease), color .2s var(--ease), background .2s var(--ease);
}
.ch-row-more svg { width: 14px; height: 14px; }
.ch-row:hover .ch-row-more,
.ch-row-more:focus-visible { opacity: 1; }
.ch-row-more:hover {
  color: var(--fg);
  background: var(--surface);
}


/* ─────────── 空态：星座图 + 双行文案 ─────────── */

.ch-empty[hidden] { display: none !important; }
.ch-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 90px 0 60px;
  text-align: center;
}
.ch-empty-art {
  width: 120px;
  height: 120px;
  color: var(--fg-3);
  margin-bottom: 6px;
  animation: ch-emptyRotate 80s linear infinite;
}
@keyframes ch-emptyRotate {
  to { transform: rotate(360deg); }
}
.ch-empty-text {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--fg);
  margin: 0;
}
.ch-empty-sub {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: 0.1em;
  color: var(--fg-3);
  margin: 0 0 14px;
}
.ch-empty-cta { margin-top: 6px; }


/* ─────────── 行菜单（置顶 / 删除） ─────────── */

.ch-menu[hidden],
.ch-confirm-shade[hidden] { display: none !important; }

.ch-menu {
  position: fixed;
  z-index: 60;
  display: flex;
  flex-direction: column;
  min-width: 128px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm, 8px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}
.ch-menu-item {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--fg-2);
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.ch-menu-item:hover {
  background: var(--surface-hover);
  color: var(--fg);
}
.ch-menu-item.is-danger:hover { color: rgb(var(--accent-2-rgb)); }


/* ─────────── 删除确认 ─────────── */

.ch-confirm-shade {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .22s var(--ease);
}
.ch-confirm-shade.is-show { opacity: 1; }
.ch-confirm {
  width: min(320px, calc(100vw - 48px));
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md, 12px);
  transform: translateY(8px);
  transition: transform .22s var(--ease);
}
.ch-confirm-shade.is-show .ch-confirm { transform: translateY(0); }
.ch-confirm-title {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
}
.ch-confirm-body {
  font-size: var(--text-sm);
  line-height: 1.65;
  color: var(--fg-2);
  margin-bottom: 18px;
}
.ch-confirm-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.ch-confirm-btn {
  padding: 7px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill, 999px);
  background: transparent;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--fg-2);
  cursor: pointer;
  transition: color .15s var(--ease), border-color .15s var(--ease), background .15s var(--ease);
}
.ch-confirm-btn:hover { color: var(--fg); border-color: var(--fg-3); }
.ch-confirm-btn.is-primary {
  border-color: transparent;
  background: rgb(var(--accent-2-rgb));
  color: #fff;
}
.ch-confirm-btn.is-primary:hover { filter: brightness(1.08); }


/* ─────────── toast ─────────── */

.ch-toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 80;
  transform: translate(-50%, 12px);
  padding: 9px 20px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill, 999px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.24);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--fg-2);
  opacity: 0;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.ch-toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}


/* ─────────── 响应式 ─────────── */

@media (max-width: 860px) {
  .chats-page { padding: 28px 16px 24px; }
  .ch-rail { left: 6px; opacity: 0.5; }
  .ch-title { font-size: 40px; }
  .ch-head { margin-bottom: 24px; }
  .ch-search-btn-text { display: none; }   /* 窄屏只留图标 + kbd */
  .ch-search-btn kbd { display: none; }
  .ch-search-btn { padding: 5px 10px; }
  .ch-search-input { width: 200px; }
  .ch-hero-sec { margin-bottom: 32px; }
  .ch-hero { min-height: 260px; }
  .ch-hero-content { max-width: 100%; padding: 22px 20px 20px; }
  .ch-hero-cta { padding: 8px 14px 8px 16px; font-size: var(--text-2xs); }
  .ch-row {
    grid-template-columns: 50px 1fr 48px 22px;
    gap: 12px;
    padding: 12px 12px 12px 0;
  }
  .ch-row-cover { display: none; }
  .ch-row-portrait { width: 48px; height: 48px; }
  .ch-row-portrait-img { width: 48px; height: 48px; }
  .ch-row-portrait-img:nth-child(2) { left: 16px; }
  .ch-row-portrait-img:nth-child(3) { left: 32px; }
  .ch-row-more { opacity: 1; }
}
