/* ============================================================
 * 罗德岛 · 干员社区
 * 视觉系统：参考森空岛（鹰角官方社区）
 * 浅色 + 深色顶栏 + 荧光黄绿 accent + 几何水印
 * ============================================================ */

:root {
  /* 主体配色 */
  --bg-page:     #F5F4EE;          /* 页面底色：暖白 */
  --bg-card:     #FFFFFF;          /* 卡片 */
  --bg-soft:     #F8F7F2;          /* 软背景 */
  --bg-input:    #FFFFFF;
  --bg-hover:    #EFEDE5;

  /* 顶栏 */
  --bg-topbar:   #1E1E1E;
  --bg-topbar-2: #2A2A28;

  /* 文字 */
  --text-0:      #1A1A1A;          /* 主文 */
  --text-1:      #4A4A48;          /* 次文 */
  --text-2:      #8E8E88;          /* 弱文 */
  --text-3:      #C0BFB8;          /* 极弱 / 占位 */
  --text-light:  #FFFFFF;
  --text-on-topbar: #FFFFFF;
  --text-on-topbar-dim: #B5B4AD;

  /* 主色：森空岛荧光黄绿 */
  --accent:        #D6FF1A;
  --accent-deep:   #B8E000;
  --accent-soft:   rgba(214, 255, 26, 0.18);

  /* 角色色（标签 chip） */
  --c-exusiai:     #FF7043;        /* 能天使橙红 */
  --c-exusiai-bg:  #FFE8DE;
  --c-kaltsit:     #2D7F8A;        /* 凯尔希深青 */
  --c-kaltsit-bg:  #DCEAEC;
  --c-doctor:      #876B1F;
  --c-doctor-bg:   #FBEEC0;

  /* 状态色 */
  --line:        #E8E5DC;          /* 主分割线 */
  --line-soft:   #F0EEE7;
  --danger:      #DA4A4A;
  --warn:        #C18A2A;

  /* 圆角 */
  --r-sm: 4px;
  --r:    6px;
  --r-lg: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Source Han Sans CN", "Noto Sans CJK SC", "Segoe UI", system-ui, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-0);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

code {
  font-family: "SF Mono", "Consolas", "Cascadia Code", monospace;
  background: var(--bg-soft);
  color: var(--text-1);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}

/* ============ 顶栏 ============ */
.topbar {
  background: var(--bg-topbar);
  border-bottom: 2px solid #000;
  position: sticky; top: 0; z-index: 100;
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; gap: 28px;
  padding: 0 32px; height: 64px;
  color: var(--text-on-topbar);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo-mark {
  width: 44px; height: 44px;
  background: var(--text-on-topbar);
  color: var(--bg-topbar);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 22px;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  position: relative;
}
.logo-mark::after {
  content: ""; position: absolute;
  bottom: -3px; left: 50%; transform: translateX(-50%);
  width: 30px; height: 1px; background: var(--text-on-topbar);
}
.brand-text { line-height: 1.15; }
.brand-title { font-weight: 700; font-size: 17px; letter-spacing: 1px; }
.brand-sub { font-size: 10px; color: var(--text-on-topbar-dim); letter-spacing: 2px; margin-top: 2px; }

.topnav { display: flex; gap: 4px; margin-left: 8px; }
.topnav a {
  padding: 22px 16px; color: var(--text-on-topbar);
  font-size: 15px; font-weight: 500;
  cursor: pointer; position: relative;
  border-bottom: 3px solid transparent;
  transition: color .15s, border .15s;
}
.topnav a:hover { color: var(--accent); }
.topnav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.topbar-spacer { flex: 1; }

.searchbox {
  display: flex; align-items: center;
  background: var(--bg-topbar-2);
  border: 1px solid #3a3a36;
  border-radius: 20px;
  padding: 6px 14px;
  width: 260px;
}
.searchbox input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text-on-topbar); font-size: 13px;
  font-family: inherit;
}
.searchbox input::placeholder { color: var(--text-on-topbar-dim); }
.searchbox .icon { color: var(--text-on-topbar-dim); margin-right: 6px; font-size: 14px; }

.btn-login {
  background: var(--accent); color: #1A1A1A;
  font-weight: 700; font-size: 14px;
  padding: 8px 26px;
  border: none; border-radius: var(--r-sm);
  cursor: pointer;
  letter-spacing: 2px;
}
.btn-login:hover { background: var(--accent-deep); }

/* ============ 主布局 ============ */
.layout {
  max-width: 1280px; margin: 0 auto;
  display: grid; grid-template-columns: 200px 1fr 280px;
  gap: 24px; padding: 24px 32px;
}

@media (max-width: 1100px) {
  .layout { grid-template-columns: 180px 1fr; }
  .right-rail { display: none; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; padding: 16px; gap: 16px; }
  .left-rail { display: none; }
  .topnav { display: none; }
  .searchbox { display: none; }
}

/* ============ 左栏 ============ */
.left-rail { min-width: 0; }
.rail-section { margin-bottom: 22px; }
.rail-title {
  font-size: 17px; font-weight: 700; color: var(--text-0);
  padding: 8px 14px 12px;
  letter-spacing: 0.5px;
  display: flex; align-items: baseline; gap: 4px;
}
.rail-title small {
  font-size: 11px; color: var(--text-3); letter-spacing: 2px;
  font-weight: 400;
}
.rail-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  font-size: 14px; color: var(--text-1);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.rail-item:hover { background: var(--bg-hover); color: var(--text-0); }
.rail-item.active {
  background: var(--bg-card);
  color: var(--text-0); font-weight: 600;
  border-left-color: var(--accent);
}
.rail-item .ico { font-size: 14px; opacity: .8; }

/* ============ 中间 feed ============ */
.feed { min-width: 0; }

/* 发帖框 */
.composer {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  margin-bottom: 20px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}
.composer-row { display: flex; gap: 12px; align-items: flex-start; }
#postInput {
  flex: 1;
  background: var(--bg-soft);
  border: 1px solid transparent;
  border-radius: var(--r);
  padding: 12px 14px;
  color: var(--text-0);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
  resize: vertical;
  min-height: 60px;
  transition: border .15s, background .15s;
}
#postInput:focus { outline: none; border-color: var(--accent); background: #fff; }
#postInput::placeholder { color: var(--text-3); }
.composer-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 12px;
}
.composer-tips { color: var(--text-2); font-size: 12px; }
.composer-tips kbd {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 3px; padding: 1px 6px; font-size: 11px;
  font-family: monospace; color: var(--text-1);
}

/* 帖子卡片 */
.post {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 18px 22px;
  margin-bottom: 16px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
  transition: box-shadow .15s, transform .15s;
}
.post.clickable { cursor: pointer; }
.post.clickable:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.08); transform: translateY(-1px); }
.post.post-detail { padding: 24px 28px; cursor: default; }
.post.post-detail .post-content { font-size: 16px; line-height: 1.85; }

/* 帖子配图占位（gradient 块）*/
.post-image-placeholder {
  margin: 8px 0 12px;
  height: 180px;
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.8); font-size: 13px;
  letter-spacing: 1px;
  position: relative;
}
.post-image-placeholder.type-gacha { background: linear-gradient(135deg, #2c3e50, #fd746c); }
.post-image-placeholder.type-cos { background: linear-gradient(135deg, #355c7d, #6c5b7b, #c06c84); }
.post-image-placeholder.type-fanart { background: linear-gradient(135deg, #74ebd5 0%, #ACB6E5 100%); }
.post-image-placeholder.type-screenshot { background: linear-gradient(135deg, #4a2860, #2a1a3a); }
.post-image-placeholder::after {
  content: "（图片占位）";
  position: absolute; bottom: 10px; right: 12px;
  font-size: 10px; opacity: .6;
}

/* ============ 视频帖 ============ */
.post-video {
  margin: 10px 0 12px;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
}
.video-player-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%;  /* 16:9 */
  background: #000;
}
.video-player-wrap iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
}
.video-info-bar {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 14px;
  padding: 9px 14px;
  background: #FAFAFA;
  font-size: 12px;
  color: var(--text-1);
}
.video-info-bar .video-platform {
  color: #FB7299;
  font-weight: 600;
}
.video-info-bar .video-bvid {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 11px;
  color: var(--text-2);
  background: #fff;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--line);
}
.video-info-bar .video-uploader {
  margin-left: auto;
  color: var(--text-2);
}

/* 真图 */
.post-image-real {
  margin: 8px 0 12px;
  border-radius: var(--r);
  overflow: hidden;
  max-width: 100%;
  cursor: zoom-in;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  transition: transform .2s, box-shadow .2s;
}
.post-image-real:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.post-image-real img {
  display: block;
  width: 100%;
  max-height: 400px;
  object-fit: cover;
}

/* 返回按钮 */
.btn-back {
  background: transparent; border: 1px solid var(--line); color: var(--text-1);
  cursor: pointer; padding: 8px 16px; border-radius: var(--r);
  font-size: 13px; font-family: inherit;
  margin-bottom: 16px; transition: background .15s;
}
.btn-back:hover { background: var(--bg-hover); color: var(--text-0); }

/* 用户评论区 */
.user-comments {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.comments-title {
  font-size: 13px; color: var(--text-1); font-weight: 600;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.comments-title .count { color: var(--text-2); font-weight: 400; }
.comment {
  display: flex; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
.comment:last-child { border-bottom: none; }
.comment-body { flex: 1; min-width: 0; }
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-author { font-weight: 600; font-size: 13px; color: var(--text-1); }
.comment-time { color: var(--text-3); font-size: 11px; }
.comment-content { font-size: 13.5px; line-height: 1.65; color: var(--text-0); word-break: break-word; }
.comment-actions {
  display: flex; gap: 12px; margin-top: 4px;
  color: var(--text-2); font-size: 11px;
}
.comment-actions .pill { cursor: pointer; }
.comment-actions .pill.liked { color: var(--c-exusiai); }
.post-header { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.post-meta { flex: 1; min-width: 0; }
.post-author {
  font-weight: 600; font-size: 15px; color: var(--text-0);
}
.post-info {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-2); font-size: 12px; margin-top: 3px;
}
.post-info .tag-zone { color: var(--text-1); }

.post-content {
  font-size: 15px; line-height: 1.8;
  white-space: pre-wrap; word-break: break-word;
  color: var(--text-0);
  margin-bottom: 12px;
}

/* 帖子底部标签 + 互动 */
.post-bottom {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 10px; border-radius: 12px;
  background: var(--bg-soft); color: var(--text-1);
  font-size: 12px;
  border: 1px solid var(--line-soft);
}
.tag.tag-hot {
  background: linear-gradient(90deg, var(--accent), #B5E83A);
  color: #1a1a1a; font-weight: 600; border-color: transparent;
}
.interact-row { display: flex; gap: 14px; color: var(--text-2); font-size: 12px; }
.interact-row .pill {
  display: inline-flex; align-items: center; gap: 4px;
  cursor: pointer; padding: 2px 6px; border-radius: 4px;
  transition: background .12s, color .12s;
}
.interact-row .pill:hover { background: var(--bg-soft); color: var(--text-0); }
.interact-row .ico { font-size: 13px; opacity: .7; }

/* ============ NPC 回复（结构同玩家评论，靠 badge + 名字色 + SVG 头像区分）============ */
.reply-chain {
  margin-top: 14px;
  border-top: 1px solid var(--line-soft);
  padding-top: 4px;
  display: flex; flex-direction: column;
}
.reply {
  display: flex; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.reply:last-child { border-bottom: none; }
.reply-body { flex: 1; min-width: 0; }
.reply-header { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.reply-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.reply-author { font-weight: 600; font-size: 13.5px; color: var(--text-0); }
.reply[data-character="能天使"] .reply-author { color: #FF7043; }
.reply[data-character="凯尔希"] .reply-author { color: #2D7F8A; }
.reply[data-character="阿米娅"] .reply-author { color: #5B7FB5; }
.reply[data-character="德克萨斯"] .reply-author { color: #9B7BBD; }
.reply[data-character="史尔特尔"] .reply-author { color: #C2185B; }
.reply[data-character="银灰"] .reply-author { color: #7B8A8B; }
.reply[data-character="早露"] .reply-author { color: #5BA3B8; }
.reply[data-character="W"] .reply-author { color: #D4A340; }
.reply-badge {
  font-size: 10px; padding: 1px 7px 1px 6px;
  background: #DCEAEC; color: #2D7F8A;
  border-radius: 3px;
  display: inline-flex; align-items: center; gap: 3px;
  font-weight: 500; letter-spacing: 0.5px;
}
.reply-badge::before { content: "✦"; font-size: 9px; }
.reply[data-character="能天使"]   .reply-badge { background: #FFE8DE; color: #FF7043; }
.reply[data-character="凯尔希"]   .reply-badge { background: #DCEAEC; color: #2D7F8A; }
.reply[data-character="阿米娅"]   .reply-badge { background: #DEE6F2; color: #5B7FB5; }
.reply[data-character="德克萨斯"] .reply-badge { background: #EAE2F2; color: #9B7BBD; }
.reply[data-character="史尔特尔"] .reply-badge { background: #FBE0EC; color: #C2185B; }
.reply[data-character="银灰"]     .reply-badge { background: #E5E8E8; color: #7B8A8B; }
.reply[data-character="早露"]     .reply-badge { background: #DEEEF3; color: #5BA3B8; }
.reply[data-character="W"]        .reply-badge { background: #F7EDD0; color: #D4A340; }
.reply-time { color: var(--text-2); font-size: 11px; }
.reply-content { font-size: 14px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; color: var(--text-0); }

/* NPC 推荐视频卡 */
.reply-video {
  margin-top: 10px;
  max-width: 480px;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #FFF;
  transition: box-shadow .15s;
}
.reply-video:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.1); }
.reply-video-iframe {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
}
.reply-video-iframe iframe {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
}
.reply-video-info { padding: 8px 12px 10px; }
.rv-title { font-size: 13px; font-weight: 600; color: var(--text-0); line-height: 1.4; margin-bottom: 3px; }
.rv-meta { font-size: 11px; color: var(--text-2); }

.reply-image-wrap {
  margin-top: 10px;
  max-width: 280px;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-soft);
  position: relative;
  cursor: zoom-in;
  border: 1px solid var(--line-soft);
}
.reply-image-wrap.loading {
  display: flex !important;
  align-items: center; justify-content: center;
  min-height: 120px;
  font-size: 12px; color: var(--text-2);
  background: linear-gradient(110deg, var(--bg-soft) 30%, var(--bg-hover) 50%, var(--bg-soft) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}
.reply-image {
  display: block; width: 100%; height: auto;
  transition: transform .25s;
}
.reply-image-wrap:hover .reply-image { transform: scale(1.02); }

/* 放大灯箱 */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none; align-items: center; justify-content: center;
  z-index: 999; cursor: zoom-out;
}
.lightbox.active { display: flex; }
.lightbox img { max-width: 90vw; max-height: 90vh; border-radius: 6px; box-shadow: 0 4px 30px rgba(0,0,0,.5); }

/* NPC 专属头像 —— 用 <img> 标签直接渲染（最稳）*/
.avatar-npc {
  border: 2px solid transparent;
  background: none;
  overflow: hidden;
  position: relative;
}
.avatar img.npc-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}
.avatar-npc::after {
  content: "✦";
  position: absolute;
  bottom: -2px; right: -2px;
  width: 14px; height: 14px;
  background: var(--c-kaltsit);
  color: #fff;
  border-radius: 50%;
  font-size: 8px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--bg-card);
  font-weight: bold;
  z-index: 2;
}
.avatar-sm.avatar-npc::after {
  width: 11px; height: 11px;
  font-size: 7px;
}

/* 思考动画 */
.thinking .dots { display: flex; gap: 4px; padding: 6px 0; }
.thinking .dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-2); animation: bounce 1.4s infinite ease-in-out;
}
.thinking .dots span:nth-child(2) { animation-delay: .2s; }
.thinking .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: .4; }
  40% { transform: scale(1); opacity: 1; }
}

/* 进入动画 */
.post, .reply { animation: slideIn .35s ease-out; }
@keyframes slideIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ 拦截卡 ============ */
.intercept-card {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--r);
  margin-top: 12px;
}
.intercept-card.warn {
  background: rgba(218, 74, 74, 0.06);
  border: 1px solid rgba(218, 74, 74, 0.25);
}
.intercept-card.info {
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.intercept-icon {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.intercept-card.warn .intercept-icon { background: var(--danger); color: #fff; }
.intercept-card.info .intercept-icon { background: var(--text-2); color: #fff; }
.intercept-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; color: var(--text-0); }
.intercept-detail { color: var(--text-1); font-size: 12px; line-height: 1.65; }

/* ============ 头像 ============ */
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 16px;
  flex-shrink: 0;
  background: var(--bg-soft);
  color: var(--text-0);
  border: 2px solid var(--line);
}
.avatar-sm { width: 30px; height: 30px; font-size: 13px; border-width: 1px; }
.avatar-能 { background: linear-gradient(135deg, #FF8A65, #E64A19); color: #fff; border-color: transparent; }
.avatar-凯 { background: linear-gradient(135deg, #6CB4BF, #2D7F8A); color: #fff; border-color: transparent; }
/* 右栏在线干员的 .avatar-能/.avatar-凯 一旦带 .avatar-npc，背景透明（img 接管） */
.avatar-能.avatar-npc,
.avatar-凯.avatar-npc { background: none; color: transparent; }
.avatar-能.avatar-npc::after,
.avatar-凯.avatar-npc::after { content: none; }
.avatar-博 { background: linear-gradient(135deg, #E8C76A, #B8902A); color: #2A1F00; border-color: transparent; }

/* ============ 右栏 ============ */
.right-rail { min-width: 0; }
.right-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}
.right-card h3 {
  margin: 0 0 14px;
  font-size: 15px; font-weight: 700; color: var(--text-0);
  display: flex; align-items: baseline; gap: 4px;
}
.right-card h3 small {
  font-size: 10px; color: var(--text-3); letter-spacing: 2px;
  font-weight: 400;
}
.npc-row {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line-soft);
}
.npc-row:last-child { border-bottom: none; padding-bottom: 0; }
.npc-row:first-child { padding-top: 0; }
.npc-meta { flex: 1; min-width: 0; }
.npc-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; color: var(--text-0); }
.npc-tag { color: var(--text-2); font-size: 11px; margin-top: 1px; }
.npc-stats { color: var(--text-3); font-size: 11px; margin-top: 4px; font-family: monospace; }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot.online { background: #4ADE80; box-shadow: 0 0 4px #4ADE80; }

.try-list { margin: 0; padding-left: 18px; color: var(--text-1); font-size: 12px; line-height: 1.9; }
.try-list li { cursor: pointer; }
.try-list li:hover { color: var(--accent-deep); }

.topic-list { display: flex; flex-wrap: wrap; gap: 6px; }
.topic-list .tag { cursor: pointer; }

/* ============ 按钮通用 ============ */
.btn-primary {
  background: var(--accent); color: #1A1A1A;
  font-weight: 700; border: none; cursor: pointer;
  padding: 9px 24px; border-radius: var(--r);
  font-size: 14px; font-family: inherit;
  transition: background .12s, box-shadow .12s;
  letter-spacing: 2px;
}
.btn-primary:hover { background: var(--accent-deep); box-shadow: 0 2px 8px rgba(184, 224, 0, 0.4); }
.btn-primary:disabled {
  background: var(--bg-hover); color: var(--text-3);
  cursor: not-allowed; box-shadow: none;
}
.btn-ghost {
  background: var(--bg-topbar-2); color: var(--text-on-topbar);
  border: 1px solid #3a3a36; cursor: pointer; font-family: inherit;
  padding: 6px 14px; border-radius: var(--r-sm); font-size: 13px;
}
.btn-ghost:hover { background: #3a3a36; }

/* ============ 调试面板 ============ */
.debug-panel {
  position: fixed; right: 24px; bottom: 24px;
  width: 380px; max-height: 60vh;
  background: #1A1A1A;
  border: 1px solid #333;
  border-radius: var(--r-lg);
  padding: 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,.35);
  z-index: 200;
  display: flex; flex-direction: column;
}
.debug-panel.hidden { display: none; }
.debug-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.debug-header h3 { margin: 0; font-size: 13px; color: var(--accent); letter-spacing: 1px; }
.btn-tiny {
  background: #2A2A28; color: var(--text-on-topbar-dim);
  border: 1px solid #3a3a36; padding: 3px 8px; border-radius: 3px;
  font-size: 11px; font-family: inherit; cursor: pointer;
}
.btn-tiny:hover { background: #3a3a36; color: var(--text-on-topbar); }
#debugLog {
  background: #0E0E0E;
  border: 1px solid #2A2A28;
  border-radius: 4px;
  padding: 10px;
  font-size: 11px;
  font-family: "SF Mono", "Consolas", monospace;
  color: var(--text-on-topbar-dim);
  overflow: auto;
  flex: 1;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.55;
  max-height: 50vh;
}
#debugLog .ok { color: #4ADE80; }
#debugLog .fail { color: #FF7A7A; }
#debugLog .stage { color: var(--accent); font-weight: 600; }

/* ============ 互动按钮 ============ */
.pill.like-btn { cursor: pointer; user-select: none; transition: all .15s; }
.pill.like-btn:hover { background: var(--bg-soft); color: var(--text-0); }
.pill.like-btn.liked { color: var(--c-exusiai); animation: likePop .3s ease-out; }
@keyframes likePop {
  0% { transform: scale(1); }
  50% { transform: scale(1.25); }
  100% { transform: scale(1); }
}
.pill.reply-btn { cursor: pointer; user-select: none; }
.pill.reply-btn:hover { background: var(--bg-soft); color: var(--text-0); }

/* 评论内联回复框 */
.comment-replies {
  margin: 8px 0 4px 22px;
  padding-left: 14px;
  border-left: 2px solid var(--line);
}
.comment-reply-composer {
  margin: 8px 0 4px 22px;
  padding: 8px 12px 8px 14px;
  border-left: 2px solid var(--line);
  display: none;
  gap: 8px;
}
.comment-reply-composer.active { display: flex; }
.comment-reply-composer input {
  flex: 1;
  background: #fff; border: 1px solid var(--line);
  border-radius: 4px; padding: 7px 10px;
  font-size: 13px; font-family: inherit;
}
.comment-reply-composer input:focus { outline: none; border-color: var(--accent); }
.comment-reply-composer button {
  background: var(--accent); color: #1a1a1a;
  border: none; padding: 5px 14px;
  border-radius: 4px; font-size: 12px;
  font-family: inherit; cursor: pointer; font-weight: 600;
}

/* 嵌套回复 —— 复用 .comment 样式，去掉额外背景 */
.nested-reply {
  padding: 8px 0;
  border-bottom: 1px dashed var(--line-soft);
}
.nested-reply:last-child { border-bottom: none; }
.nested-reply .avatar { width: 28px; height: 28px; font-size: 12px; }
.nested-reply .quote-target {
  font-size: 11px; color: var(--text-2);
  margin-bottom: 3px;
}
.nested-reply .quote-target .at-target {
  color: var(--c-doctor); font-weight: 600;
}

/* 嵌套区域内的 NPC 回复（沿用 .reply 但适配缩进上下文） */
.comment-replies .reply {
  padding: 8px 0;
  border-bottom: 1px dashed var(--line-soft);
}
.comment-replies .reply:last-child { border-bottom: none; }
.comment-replies .reply .avatar { width: 28px; height: 28px; }

/* ============ 多轮对话 thread + 回复框 ============ */
.reply-chain:empty { display: none; }

/* === 每个 NPC 回复都是独立的 thread-root === */
.reply-thread {
  margin-bottom: 8px;
}
.reply-thread:last-child { margin-bottom: 0; }

/* 该 thread 下方的子对话（缩进 + 竖线） */
.nested-thread {
  margin: 6px 0 0 22px;
  padding-left: 14px;
  border-left: 2px solid var(--line);
}
.nested-thread:empty { display: none; }
.nested-thread > * { padding: 8px 0; }
.nested-thread > *:first-child { padding-top: 6px; }

/* 子回复框：默认隐藏，点 💬回复 才展开 */
.nested-composer {
  margin: 6px 0 0 22px;
  padding-left: 14px;
  border-left: 2px dashed var(--line);
  display: none;
}
.nested-composer.active { display: block; }
.nested-composer .reply-composer {
  margin-top: 6px;
  padding: 10px 12px;
}

/* 让 reply 自带的 .reply-actions 显示 "💬 回复" 按钮 */
.reply-reply-btn {
  cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 6px; border-radius: 4px;
  font-size: 12px; color: var(--text-2);
  margin-top: 6px;
  transition: background .12s, color .12s;
}
.reply-reply-btn:hover { background: var(--bg-soft); color: var(--text-0); }
.reply-reply-btn.active { background: var(--accent-soft); color: var(--accent-deep); }
.thread-msg {
  display: flex; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
.thread-msg:last-child { border-bottom: none; }
.thread-msg .avatar { width: 32px; height: 32px; font-size: 13px; border-width: 1px; }
.thread-body { flex: 1; min-width: 0; }
.thread-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 3px;
}
.thread-author { font-weight: 600; font-size: 13px; }
.thread-msg.type-player .thread-author { color: var(--c-doctor); }
.thread-time { color: var(--text-2); font-size: 11px; }
.thread-content {
  font-size: 13.5px; line-height: 1.75;
  color: var(--text-0);
  white-space: pre-wrap; word-break: break-word;
}

/* 回复框 */
.reply-composer {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--bg-soft);
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
}
.rc-row { display: flex; gap: 12px; align-items: flex-start; }
.rc-body { flex: 1; min-width: 0; }
.rc-input {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 12px;
  font-family: inherit; font-size: 14px;
  line-height: 1.65; resize: vertical;
  min-height: 56px;
  transition: border .15s;
}
.rc-input:focus { outline: none; border-color: var(--accent); }
.rc-input::placeholder { color: var(--text-3); }
.rc-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px;
}
.rc-mentions { display: flex; gap: 6px; }
.rc-mention-btn {
  background: #fff; border: 1px solid var(--line);
  color: var(--text-1); padding: 4px 10px; border-radius: 4px;
  font-size: 11px; font-family: inherit; cursor: pointer;
  transition: all .12s;
}
.rc-mention-btn:hover { background: var(--accent-soft); color: var(--text-0); border-color: var(--accent); }
.rc-submit {
  padding: 6px 18px; font-size: 13px; letter-spacing: 1px;
}

/* ============ NPC Profile 页 ============ */
.profile-page {
  margin: -24px -32px 0;
  padding: 0;
  animation: pageFadeIn .5s ease-out;
}
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero */
.profile-hero {
  position: relative;
  min-height: 380px;
  padding: 56px 40px 100px;
  overflow: hidden;
  color: #fff;
  display: flex; align-items: center; gap: 36px;
}
.profile-hero::before {
  content: ""; position: absolute; inset: 0;
  z-index: 0;
  filter: blur(40px);
  transform: scale(1.1);
}
.profile-hero::after {
  content: ""; position: absolute; inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.55) 100%);
}
.profile-hero > * { position: relative; z-index: 2; }

.profile-hero-avatar {
  width: 200px; height: 200px; border-radius: 50%;
  border: 5px solid rgba(255,255,255,0.95);
  box-shadow: 0 8px 40px rgba(0,0,0,0.4), 0 0 80px rgba(255,255,255,0.15);
  overflow: hidden; flex-shrink: 0;
  animation: avatarFloat 4s ease-in-out infinite;
}
.profile-hero-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
@keyframes avatarFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.profile-hero-text { flex: 1; min-width: 0; }
.profile-eyebrow {
  font-size: 11px; letter-spacing: 4px; opacity: 0.9;
  font-family: "SF Mono", Consolas, monospace;
  margin-bottom: 8px;
}
.profile-name-zh {
  font-size: 42px; font-weight: 800; letter-spacing: 2px;
  margin: 0; line-height: 1.1;
  text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.profile-name-en {
  font-size: 14px; opacity: 0.75; letter-spacing: 4px;
  margin: 6px 0 14px;
  font-family: "SF Mono", Consolas, monospace;
}
.profile-role {
  font-size: 14px; opacity: 0.95; margin-bottom: 6px;
}
.profile-origin {
  font-size: 12px; opacity: 0.7;
  display: flex; align-items: center; gap: 6px;
}
.profile-tagline {
  margin-top: 18px;
  font-size: 17px; font-style: italic;
  opacity: 0.95;
  border-left: 3px solid rgba(255,255,255,0.9);
  padding-left: 14px;
  line-height: 1.5;
}
.profile-status-row {
  margin-top: 16px;
  display: flex; gap: 18px; font-size: 12px;
}
.profile-status-row .item {
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 5px 12px; border-radius: 20px;
}

/* Body */
.profile-body {
  margin-top: -60px;
  padding: 0 40px 40px;
  position: relative; z-index: 3;
}
.profile-card {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 22px 26px;
  margin-bottom: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  animation: cardSlideIn .5s ease-out backwards;
}
.profile-card:nth-child(1) { animation-delay: 0.05s; }
.profile-card:nth-child(2) { animation-delay: 0.1s; }
.profile-card:nth-child(3) { animation-delay: 0.15s; }
.profile-card:nth-child(4) { animation-delay: 0.2s; }
.profile-card:nth-child(5) { animation-delay: 0.25s; }
.profile-card:nth-child(6) { animation-delay: 0.3s; }
@keyframes cardSlideIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.profile-card-title {
  font-size: 12px; font-weight: 700; letter-spacing: 3px;
  color: var(--text-2); text-transform: uppercase;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 8px;
}
.profile-card-title .accent-bar {
  width: 3px; height: 14px; border-radius: 2px;
}

.profile-bio { font-size: 14.5px; line-height: 1.85; color: var(--text-0); }

.trait-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.trait-chip {
  padding: 4px 12px; border-radius: 14px;
  font-size: 12.5px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text-1);
  transition: transform .15s, box-shadow .15s;
}
.trait-chip:hover { transform: translateY(-2px); box-shadow: 0 3px 8px rgba(0,0,0,0.08); }
.trait-chip.hidden-trait {
  background: linear-gradient(135deg, #f8f6f0, #ede8d8);
  font-style: italic;
}
.trait-chip.anchor {
  font-weight: 700;
}

.voice-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.voice-item { font-size: 13px; line-height: 1.7; }
.voice-key {
  font-weight: 700; color: var(--text-2); font-size: 11px;
  letter-spacing: 1px; text-transform: uppercase;
  margin-bottom: 4px;
}
.voice-val { color: var(--text-0); }

.quote-list { display: flex; flex-direction: column; gap: 12px; }
.quote {
  padding: 12px 16px; border-radius: 8px;
  background: var(--bg-soft);
  border-left: 3px solid;
  font-size: 14px; line-height: 1.7;
  color: var(--text-0);
  position: relative;
  transition: transform .15s;
}
.quote:hover { transform: translateX(4px); }

.relations-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.relation-item {
  padding: 10px 14px;
  background: var(--bg-soft);
  border-radius: 6px;
  font-size: 13px;
}
.relation-name { font-weight: 700; color: var(--text-0); margin-bottom: 2px; }
.relation-desc { color: var(--text-2); font-size: 12px; line-height: 1.5; }

.scenario-list { display: flex; flex-direction: column; gap: 10px; }
.scenario-item {
  padding: 12px 14px;
  background: var(--bg-soft);
  border-radius: 6px;
  border-left: 3px solid;
}
.scenario-tag {
  font-size: 11px; font-weight: 700;
  display: inline-block; padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 6px;
  color: #fff;
}
.scenario-sample {
  font-size: 13.5px; color: var(--text-0);
  line-height: 1.65; font-style: italic;
}

.recent-replies-list { display: flex; flex-direction: column; gap: 10px; }
.recent-reply {
  display: flex; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.recent-reply:last-child { border-bottom: none; }
.recent-reply .from-post {
  color: var(--text-2); font-size: 11px; margin-bottom: 3px;
  cursor: pointer;
}
.recent-reply .from-post:hover { color: var(--text-0); }
.recent-reply .text { color: var(--text-0); line-height: 1.65; }
.empty-state {
  color: var(--text-2); font-size: 13px;
  text-align: center; padding: 20px 0;
}

@media (max-width: 760px) {
  .profile-hero { flex-direction: column; text-align: center; padding: 36px 24px 80px; }
  .profile-name-zh { font-size: 32px; }
  .profile-body { padding: 0 16px 24px; }
  .voice-grid, .relations-grid { grid-template-columns: 1fr; }
}

/* 让头像/名字可点击 */
.avatar.clickable-npc, .npc-row .npc-name.clickable-npc { cursor: pointer; }
.npc-row .avatar { cursor: pointer; transition: transform .15s; }
.npc-row:hover .avatar { transform: scale(1.05); }
.reply .avatar.avatar-npc { cursor: pointer; transition: transform .15s; }
.reply .avatar.avatar-npc:hover { transform: scale(1.08); }
.reply-author { cursor: pointer; }
.reply-author:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ============ Profile 档案 grid ============ */
.profile-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.stat-item {
  display: flex; flex-direction: column;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: 6px;
  border-left: 2px solid var(--line);
}
.stat-item.stat-wide { grid-column: 1 / -1; }
.stat-label {
  font-size: 10px; letter-spacing: 2px;
  color: var(--text-2); text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 4px;
}
.stat-val {
  font-size: 13px; color: var(--text-0); font-weight: 500;
  line-height: 1.4;
}
@media (max-width: 760px) {
  .profile-stat-grid { grid-template-columns: 1fr 1fr; }
}

/* Profile 内嵌关系列表 */
.relations-list-profile {
  display: flex; flex-direction: column;
  gap: 8px;
}
.rel-card {
  display: flex; gap: 12px; align-items: center;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: 6px;
  border: 1px solid var(--line-soft);
  transition: transform .15s, border-color .15s;
}
.rel-card[data-nav-profile]:hover { transform: translateX(3px); border-color: var(--line); }
.rel-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  overflow: hidden; flex-shrink: 0;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
}
.rel-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rel-fallback {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #E8C76A, #B8902A);
  color: #2A1F00;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
}
.rel-body { flex: 1; min-width: 0; }
.rel-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 2px;
}
.rel-name { font-weight: 600; font-size: 13.5px; color: var(--text-0); }
.rel-type {
  font-size: 10px; padding: 1px 7px; border-radius: 8px;
  letter-spacing: 0.5px; font-weight: 600;
}
.rel-desc { font-size: 12px; color: var(--text-1); line-height: 1.55; }

/* ============ 关系网独立页 ============ */
.relations-page {
  padding: 0 0 40px;
  animation: pageFadeIn .5s ease-out;
}
.relations-header {
  text-align: center;
  padding: 32px 24px 16px;
}
.relations-eyebrow {
  font-size: 11px; letter-spacing: 4px;
  color: var(--text-3); font-weight: 600;
  margin-bottom: 10px;
}
.relations-header h1 {
  margin: 0 0 10px; font-size: 28px;
  font-weight: 800; letter-spacing: 2px;
}
.relations-sub {
  font-size: 13px; color: var(--text-1);
  max-width: 540px; margin: 0 auto; line-height: 1.7;
}
.relations-canvas {
  margin: 8px auto 20px;
  max-width: 760px;
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  padding: 16px;
}
.relations-svg { width: 100%; height: auto; display: block; }
.relations-svg .node circle { transition: stroke-width .15s; }
.relations-svg .edge { transition: opacity .2s; }
.relations-svg .node text { user-select: none; pointer-events: none; }

.relations-legend {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px;
  max-width: 760px; margin: 16px auto;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--r);
  border: 1px solid var(--line);
}
.relations-legend .legend-title {
  font-size: 11px; letter-spacing: 2px;
  color: var(--text-2); font-weight: 700;
  margin-right: 8px;
}
.relations-legend .legend-chip {
  font-size: 11px; padding: 3px 9px;
  border-radius: 10px; font-weight: 600;
}

.relations-list {
  max-width: 760px; margin: 20px auto;
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  padding: 20px 24px;
}
.relations-list h3 {
  margin: 0 0 14px; font-size: 13px;
  letter-spacing: 3px; color: var(--text-2);
  font-weight: 700; text-transform: uppercase;
  padding-bottom: 10px; border-bottom: 1px solid var(--line-soft);
}
.rel-list-item {
  display: grid;
  grid-template-columns: 80px 1fr 2fr;
  gap: 14px; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.rel-list-item:last-child { border-bottom: none; }
.rel-type-tag {
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  text-align: center; letter-spacing: 1px; font-weight: 600;
}
.rel-list-pair b {
  color: var(--text-0); cursor: pointer;
  border-bottom: 1px dotted transparent;
  transition: border-color .15s;
}
.rel-list-pair b:hover { border-bottom-color: var(--accent); color: var(--accent-deep); }
.rel-list-desc { color: var(--text-1); font-size: 12.5px; }
@media (max-width: 760px) {
  .rel-list-item { grid-template-columns: 70px 1fr; gap: 8px; }
  .rel-list-desc { grid-column: 1 / -1; padding-left: 78px; }
}

/* ============ 滚动条 ============ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
