/* ==========================================================================
   托尔兹军官学院 —— 主题：蒸汽朋克（Steampunk）
   视觉语言：深胡桃木底 / 做旧黄铜描边 / 紫铜冲压面板 / 铆钉 / 齿轮 / 炉火火星
   布局：顶栏 + 单列内容区（已移除左侧栏）
   网格：照片 / 角色卡 每排 6 张、不分页；悬赏 4 列分页；留言每排 1 条
   ========================================================================== */

:root {
  --legal-h: 26px;                 /* 底部备案条高度；改这一个数字即可（引用它的地方都会自动跟着变） */
  /* ---- 主题色基（rgb 三元组，配合 rgb(var(--c-x) / alpha) 使用）----
     换肤只改这一段：把下面 16 个三元组换成另一套色，全站跟着变 */
  --c-brass: 201 162 39;         /* 主金属：描边 / 文字 / 高光 */
  --c-brass-hi: 240 211 138;     /* 亮金属 */
  --c-brass-dark: 138 109 31;    /* 暗金属（冲压板底） */
  --c-rivet: 245 222 158;        /* 铆钉 / 极亮 */
  --c-copper: 184 115 51;        /* 紫铜 */
  --c-copper-hi: 232 168 106;    /* 亮紫铜 */
  --c-copper-dark: 125 74 28;    /* 暗紫铜 */
  --c-bronze: 125 90 52;         /* 青铜 */
  --c-ember: 255 157 77;         /* 炉火 */
  --c-verdigris: 78 133 119;     /* 铜绿 */
  --c-panel-hi: 56 43 31;        /* 面板亮部 */
  --c-panel: 38 29 22;           /* 面板 */
  --c-panel-lo: 25 19 14;        /* 面板暗部 */
  --c-ink: 18 13 9;              /* 最暗 / 遮罩 */
  --c-hi: 255 240 200;           /* 高光白 */
  --c-text: 239 227 200;         /* 正文 */
  --c-text-dim: 179 161 132;     /* 次要文字 */
  --on-brass: #211503;           /* 黄铜板上的深色字：偏暖的近黑，比原来的橄榄棕更沉更清楚 */

  /* ---- 金属 ---- */
  --brass: rgb(var(--c-brass));
  --brass-light: rgb(var(--c-brass-hi));
  --brass-dark: rgb(var(--c-brass-dark));
  --copper: rgb(var(--c-copper));
  --copper-light: rgb(var(--c-copper-hi));
  --bronze: rgb(var(--c-bronze));
  --ember: rgb(var(--c-ember));
  --verdigris: rgb(var(--c-verdigris));

  /* ---- 底色与面板 ---- */
  --bg-deep: rgb(var(--c-ink));
  --bg-panel: rgb(var(--c-panel) / 0.96);
  --bg-panel-solid: rgb(var(--c-panel));
  --panel-face: linear-gradient(180deg, rgb(var(--c-panel-hi) / 0.97), rgb(var(--c-panel-lo) / 0.98));

  /* ---- 线条 ---- */
  --line: rgb(var(--c-brass) / 0.30);
  --line-soft: rgb(var(--c-brass) / 0.16);
  --line-strong: rgb(var(--c-brass-hi) / 0.55);

  /* ---- 文字 ---- */
  --text: rgb(var(--c-text));
  --text-strong: rgb(var(--c-hi));
  --text-dim: rgb(var(--c-text-dim));

  /* ---- 大标题：底色渐变 + 扫过的一道寒光（两套主题各换底色，寒光通用）---- */
  --title-face: linear-gradient(180deg, rgb(var(--c-hi)), rgb(var(--c-brass-hi)) 42%, rgb(var(--c-brass)) 100%);
  --title-shine: linear-gradient(105deg, rgba(210, 240, 255, 0) 44%, rgba(230, 248, 255, 0.95) 50%, rgba(210, 240, 255, 0) 56%);
  --danger: #d9534f;

  /* ---- 渐变 ---- */
  --brass-plate: linear-gradient(180deg, rgb(var(--c-brass-hi)), rgb(var(--c-brass)) 48%, rgb(var(--c-brass-dark)));
  --copper-plate: linear-gradient(180deg, rgb(var(--c-copper-hi)), rgb(var(--c-copper)) 50%, rgb(var(--c-copper-dark)));
  --ember-line: linear-gradient(90deg, transparent, rgb(var(--c-brass) / 0.7) 20%, rgb(var(--c-ember) / 0.9) 50%, rgb(var(--c-brass) / 0.7) 80%, transparent);

  /* ---- 形状 ---- */
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
  --shadow-panel:
    0 12px 30px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgb(var(--c-hi) / 0.10),
    inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  --shadow-lift:
    0 16px 36px rgba(0, 0, 0, 0.65),
    0 0 22px rgb(var(--c-brass-hi) / 0.28),
    inset 0 1px 0 rgb(var(--c-hi) / 0.14);

  /* ---- 铆钉（四个角） ---- */
  --rivets:
    radial-gradient(circle at 10px 10px, rgb(var(--c-rivet) / 0.55) 0 1.8px, rgba(0, 0, 0, 0.5) 1.8px 2.9px, transparent 3.1px),
    radial-gradient(circle at calc(100% - 10px) 10px, rgb(var(--c-rivet) / 0.55) 0 1.8px, rgba(0, 0, 0, 0.5) 1.8px 2.9px, transparent 3.1px),
    radial-gradient(circle at 10px calc(100% - 10px), rgb(var(--c-rivet) / 0.55) 0 1.8px, rgba(0, 0, 0, 0.5) 1.8px 2.9px, transparent 3.1px),
    radial-gradient(circle at calc(100% - 10px) calc(100% - 10px), rgb(var(--c-rivet) / 0.55) 0 1.8px, rgba(0, 0, 0, 0.5) 1.8px 2.9px, transparent 3.1px);

  --veil: 0.35;
  --pad-side: 32px;          /* 照片 / 角色卡 两侧留白 */

  /* 萝莉体（本机装了就用它，没装自动回退到后面的微软雅黑等）
     字体内部家族名：英文 Lolita / 中文 萝莉体，两个都写上去更稳 */
  --font-display: 'Lolita', '萝莉体', Georgia, 'Times New Roman', 'KaiTi', '楷体', 'STKaiti', 'Microsoft YaHei', serif;
  --font-body: 'Lolita', '萝莉体', 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', system-ui, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: var(--font-body);
  /* 齿轮/铆钉底纹 + 斜纹金属肌理 + 炉火/黄铜/铜绿三团光晕 + 深胡桃木底 */
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='132' height='132'%3E%3Cg fill='none' stroke='rgba(201,162,39,0.13)' stroke-width='1.1'%3E%3Ccircle cx='36' cy='36' r='13'/%3E%3Ccircle cx='36' cy='36' r='4.2'/%3E%3Cpath d='M36 19v-6M36 53v6M19 36h-6M53 36h6M24 24l-4.2-4.2M48 48l4.2 4.2M48 24l4.2-4.2M24 48l-4.2 4.2'/%3E%3Ccircle cx='100' cy='94' r='7.5'/%3E%3Ccircle cx='100' cy='94' r='2.4'/%3E%3Cpath d='M100 84v-5M100 104v5M90 94h-5M110 94h5'/%3E%3C/g%3E%3Cg fill='rgba(240,211,138,0.16)'%3E%3Ccircle cx='94' cy='26' r='2.2'/%3E%3Ccircle cx='18' cy='100' r='2.2'/%3E%3Ccircle cx='68' cy='64' r='1.5'/%3E%3C/g%3E%3C/svg%3E") repeat,
    repeating-linear-gradient(135deg, rgb(var(--c-hi) / 0.014) 0 2px, transparent 2px 7px),
    radial-gradient(1100px 620px at 84% -8%, rgb(var(--c-brass-hi) / 0.14), transparent 62%),
    radial-gradient(900px 560px at 4% 10%, rgb(var(--c-brass) / 0.13), transparent 62%),
    radial-gradient(760px 520px at 46% 112%, rgba(78, 133, 119, 0.10), transparent 62%),
    var(--bg-deep);
  background-size: 132px 132px, auto, auto, auto, auto, auto;
  background-attachment: fixed;
  overflow-x: hidden;
}

::selection { background: rgb(var(--c-brass) / 0.45); color: rgb(var(--c-hi)); }

/* 黄铜滚动条 */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: rgb(var(--c-ink) / 0.8); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgb(var(--c-brass) / 0.6), rgb(var(--c-copper) / 0.7));
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, rgb(var(--c-rivet) / 0.8), rgb(var(--c-brass) / 0.85)); background-clip: padding-box; }

/* ---------- 图层顺序：背景图(-3) → 齿轮火星(-2) → 遮罩(-1) → 内容 ---------- */
#bg-layer {
  position: fixed;
  inset: 0;
  z-index: -3;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  animation: bgDrift 46s ease-in-out infinite alternate;
}

@keyframes bgDrift {
  from { transform: scale(1); }
  to { transform: scale(1.05); }
}

#emberfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: transparent;
  transition: background 0.3s;
}
body.has-bg::after { background: rgb(var(--c-ink) / var(--veil)); }

/* ============================ 顶栏 ============================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 78;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  /* 通栏：贴齐网页顶端与左右两侧，只留一条底边当分界 */
  margin: 0 -20px;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: var(--shadow-panel);
  background-color: rgb(var(--c-panel) / 0.95);
  background-image:
    repeating-linear-gradient(90deg, rgb(var(--c-hi) / 0.03) 0 1px, transparent 1px 7px),
    var(--panel-face);
}

/* 品牌区：站点名 + Logo（两者间距固定 10px，窄屏时文字先缩、Logo 保持比例） */
.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-wrap .brand { flex: 0 1 auto; min-width: 0; }

.brand-logo {
  flex: none;
  display: block;
  height: 30px;
  width: auto;
  max-width: 40vw;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

@media (max-width: 720px) {
  .brand-logo { height: 24px; }
}
@media (max-width: 460px) {
  .brand-logo { height: 20px; }
}

.brand {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 3px;
  color: rgb(var(--c-brass-hi));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46vw;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.65);
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.server-flag {
  font-size: 11.5px;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(217, 83, 79, 0.6);
  color: #ffc9c5;
  background: rgba(120, 40, 34, 0.35);
  white-space: nowrap;
}
.server-flag.is-ok { border-color: rgba(120, 200, 140, 0.5); color: #c8f0d2; background: rgba(40, 90, 55, 0.3); }

/* 登录 / 注册按钮（抛光黄铜铭牌） */
.auth-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--on-brass);
  padding: 9px 18px;
  border: 2px solid rgb(var(--c-hi) / 0.5);
  border-radius: 999px;
  background: var(--brass-plate);
  cursor: pointer;
  text-shadow: 0 1px 0 rgb(var(--c-hi) / 0.5);
  box-shadow:
    0 5px 16px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgb(var(--c-hi) / 0.8),
    inset 0 -3px 8px rgba(0, 0, 0, 0.35);
  transition: filter 0.2s, transform 0.15s, box-shadow 0.2s;
  white-space: nowrap;
}
.auth-btn:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.55),
    0 0 22px rgb(var(--c-brass-hi) / 0.35),
    inset 0 1px 0 rgb(var(--c-hi) / 0.85),
    inset 0 -3px 8px rgba(0, 0, 0, 0.35);
}
.auth-ico { font-size: 14px; }

/* 登录后：圆形头像 + 用户名（普通样式，不是按钮） */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 3px 8px 3px 3px;
  margin: -3px -8px -3px -3px;
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 2px;
  color: rgb(var(--c-brass-hi));                  /* 和顶栏标题同一个黄铜色 */
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.user-chip:hover { background: rgb(var(--c-brass) / 0.12); color: rgb(var(--c-hi)); }
.user-chip:hover .user-name { text-decoration: underline; text-underline-offset: 3px; }

.chip-avatar {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  display: block;
  border: 2px solid rgb(var(--c-rivet) / 0.55);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
span.chip-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brass-plate);
  color: var(--on-brass);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
}

.user-name { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 后端未启动提示条 */
.server-warn {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
  margin-top: 14px;
  padding: 12px 16px;
  border: 1px solid rgba(217, 83, 79, 0.55);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(92, 33, 26, 0.72), rgba(40, 18, 14, 0.85));
  color: #ffd9d2;
  font-size: 13.5px;
  line-height: 1.75;
  box-shadow: inset 0 1px 0 rgba(255, 200, 190, 0.15);
}
.server-warn code {
  font-family: Consolas, 'Courier New', monospace;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 200, 190, 0.25);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12.5px;
  color: rgb(var(--c-rivet));
}

/* ============================ 布局 ============================ */

.app { display: block; padding: 0 20px 20px; min-height: 100vh; }

.main { min-width: 0; }

/* ============================ 标题区 ============================ */

.head {
  position: relative;
  text-align: center;
  padding: 34px 18px 42px;           /* 底部留白：越小标题越往下（指示器在 20~36px 处） */
  min-height: 380px;                 /* 页头高度：想更高/更矮改这里 */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;         /* 标题整体往下靠（改回 center 就垂直居中） */
  /* 通栏：左右贴齐，紧接在顶栏下面（顶栏底边即分界，不用再叠边框） */
  margin: 0 -20px;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: var(--shadow-panel);
  overflow: hidden;
  background-color: rgb(var(--c-ink));
}

/* 页头背景轮播的两层（图片由 app.js 轮流塞进来）
   切换时渐隐渐显；每张图在显示期间还会很慢地上下浮动 */
.head-bg {
  position: absolute;
  inset: -5% 0;                      /* 上下各多留 5%，浮动时不会露出边缘 */
  z-index: 0;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s ease;
  animation: headFloat 16s ease-in-out infinite;
}
.head-bg.is-on { opacity: 1; z-index: 1; }          /* 正在显示的那张（渐显完成后压在上层）*/

/* 上下缓慢浮动：±3% 位移、16 秒一个来回（嫌快/慢就改 16s，嫌幅度小就改 3%） */
@keyframes headFloat {
  0%, 100% { transform: translateY(-3%); }
  50%      { transform: translateY(3%); }
}

/* 背景上的深色压层：保证渐变标题在任何一张背景上都读得清
   注意层级：背景层 0/1 → 压层 2 → 文字 3 → 指示器 4
   所以翻页时那张纸是从压层底下翻过去的，永远不会盖住标题 */
.head-veil {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(180deg, rgb(var(--c-ink) / 0.58), rgb(var(--c-ink) / 0.80));
}

/* 轮播指示器：横着几条线，靠左摆放，点哪条跳哪张 */
.head-dots {
  position: absolute;
  left: 24px;                         /* 靠左（改回 50% + transform 就居中） */
  bottom: 20px;
  z-index: 4;                         /* 最上层：翻页时也始终可点 */
  display: flex;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.head-dot {
  appearance: none;
  width: 34px;
  height: 4px;
  padding: 0;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: rgb(var(--c-hi) / 0.30);
  box-shadow: inset 0 0 0 1px rgb(var(--c-hi) / 0.16);
  transition: background 0.25s, box-shadow 0.25s, transform 0.2s;
}
.head-dot:hover { background: rgb(var(--c-hi) / 0.62); transform: scaleY(1.7); }
.head-dot.is-on {
  background: linear-gradient(90deg, rgb(var(--c-brass-hi)), rgb(var(--c-brass)));
  box-shadow: 0 0 10px rgb(var(--c-brass-hi) / 0.7), inset 0 0 0 1px rgb(var(--c-hi) / 0.5);
}

@media (max-width: 560px) {
  .head-dot { width: 24px; height: 3.5px; }
  .head-dots { gap: 6px; bottom: 12px; }
}

.site-title {
  position: relative;
  z-index: 3;                        /* 压在压层与翻页纸之上 */
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(36px, 5.2vw, 76px);   /* 比原来（30 / 4.4vw / 62）放大一级 */
  font-weight: 700;
  letter-spacing: 8px;
  text-align: center;
  padding: 6px 18px;
  border-radius: var(--radius-sm);
  outline: none;
  display: inline-block;
  max-width: 100%;
  color: rgb(var(--c-brass-hi));
  /* 两层背景一起裁进文字里：①会移动的寒光亮带 ②主题底色渐变 */
  background-image: var(--title-shine), var(--title-face);
  background-size: 45% 100%, 100% 100%;
  background-position: -100% 0, 0 0;
  background-repeat: no-repeat, no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: titleShine 5.2s ease-in-out infinite, lampGlow 5.5s ease-in-out infinite;
}

/* 一道寒光从左到右扫过标题，扫完停一会儿再来一次 */
@keyframes titleShine {
  0%, 12%   { background-position: -100% 0, 0 0; }
  52%, 100% { background-position: 200% 0, 0 0; }
}

/* 日文副标题（トールズ士官学院）：朴素显示，不做描金渐变 / 扫光 / 辉光
   只保留一点点文字投影保证压在背景图上看得清 */
.site-title-jp {
  position: relative;
  z-index: 3;
  margin: 6px 0 0;
  font-family: var(--font-body);     /* 用正文字体，不是标题那种衬线体 */
  font-size: clamp(15px, 2.1vw, 30px);
  font-weight: 400;
  letter-spacing: 4px;
  text-align: center;
  padding: 0 12px;
  display: inline-block;
  max-width: 100%;
  color: var(--text-dim);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* 煤气灯般的呼吸辉光 */
@keyframes lampGlow {
  0%, 100% { filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.65)) drop-shadow(0 0 16px rgb(var(--c-brass-hi) / 0.26)); }
  50% { filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.65)) drop-shadow(0 0 30px rgb(var(--c-brass-hi) / 0.5)); }
}

/* 标题是固定文案（不可编辑），所以不再有 hover / focus 交互样式 */

.head-hint {
  position: relative;
  z-index: 3;                        /* 压在压层与翻页纸之上 */
  margin: 10px 0 0;
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

/* 标题下方：黄铜—炉火渐变刻线 */
.head::after {
  content: "";
  position: relative;
  z-index: 3;                        /* 压在压层与翻页纸之上 */
  display: block;
  width: min(520px, 74%);
  height: 2px;
  margin: 16px auto 0;
  background: var(--ember-line);
  box-shadow: 0 0 12px rgb(var(--c-brass-hi) / 0.45);
}

/* ============================ 横排导航 list ============================ */

.tabs {
  position: relative;               /* 滑动滑块的定位基准 */
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  margin: 18px auto 22px;
  padding: 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-panel);
  background-color: var(--bg-panel);
  background-image: var(--panel-face);
}

/* 会滑动的选中底色：鼠标移到哪个标签就滑到哪，点击才算真正切换 */
.tab-glider {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  z-index: 0;
  border-radius: 999px;
  border: 1px solid rgb(var(--c-rivet) / 0.5);
  background: linear-gradient(180deg, rgb(var(--c-brass) / 0.34), rgb(var(--c-copper) / 0.24));
  box-shadow: inset 0 1px 0 rgb(var(--c-hi) / 0.35), 0 0 18px rgb(var(--c-brass-hi) / 0.22);
  pointer-events: none;
  opacity: 0;
  transition:
    left 0.28s cubic-bezier(0.22, 0.9, 0.3, 1),
    top 0.28s cubic-bezier(0.22, 0.9, 0.3, 1),
    width 0.28s cubic-bezier(0.22, 0.9, 0.3, 1),
    height 0.28s cubic-bezier(0.22, 0.9, 0.3, 1),
    opacity 0.2s;
}
.tab-glider.is-on { opacity: 1; }
.tab-glider.is-instant { transition: none; }    /* 翻页/缩放窗口时直接归位，不要滑 */

/* 底下那条发光短线跟着一起滑 */
.tab-glider::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgb(var(--c-brass-hi)), rgb(var(--c-brass-hi)));
  box-shadow: 0 0 9px rgb(var(--c-brass-hi) / 0.9);
}

.tab {
  position: relative;
  z-index: 1;                       /* 文字压在滑动滑块之上 */
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 15px;
  letter-spacing: 2px;
  padding: 9px 22px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s;
  white-space: nowrap;
}

.tab:hover { color: var(--text); }

/* 选中态只负责把字点亮，底色和发光短线都交给会滑动的 .tab-glider */
.tab.is-active { color: rgb(var(--c-hi)); }

/* 模块标签栏左右两端的翻页箭头（每页最多 4 个模块，多余的在下一页） */
.tab-nav {
  position: relative;
  z-index: 1;                       /* 同样压在滑块之上 */
  flex: none;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 3px;              /* ‹ › 视觉居中补偿 */
  font-family: inherit;
  font-size: 20px;
  line-height: 1;
  color: var(--text-dim);
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  transition: color 0.2s, background 0.2s, border-color 0.2s, opacity 0.2s;
}
.tab-nav:hover:not(:disabled) {
  color: rgb(var(--c-brass-hi));
  background: rgb(var(--c-brass) / 0.14);
  border-color: rgb(var(--c-rivet) / 0.4);
}
.tab-nav:active:not(:disabled) { transform: translateY(1px); }
.tab-nav:disabled { opacity: 0.3; cursor: not-allowed; }

@media (max-width: 560px) {
  .tab-nav { width: 28px; height: 28px; font-size: 17px; }
}

/* ============================ 面板 / 工具条 ============================ */

.panel { display: none; }
.panel.is-active { display: block; animation: panelIn 0.32s ease backwards; }

/* 照片与角色卡：两边各留 32px */
[data-panel="photos"],
[data-panel="cards"] { padding: 0 var(--pad-side); }

@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.meta { color: var(--text-dim); font-size: 13px; }

.pager { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ---------- 搜索框（故事接龙）---------- */

.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;                 /* 把自己和翻页一起推到右边 */
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(var(--c-ink) / 0.6);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: border-color 0.2s, box-shadow 0.2s;
}
/* 搜索框后面紧跟着翻页时，让翻页不要再去抢那点空隙，两者就贴在一起了 */
.search-box + .pager { margin-left: 0; }
.search-box:focus-within {
  border-color: var(--brass);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4), 0 0 0 3px rgb(var(--c-brass) / 0.18);
}
.search-box input {
  width: 210px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  padding: 8px 4px 8px 12px;
}
.search-box input::placeholder { color: var(--text-dim); }

/* 「搜索」按钮：点它（或按回车）才真正筛选 */
.search-btn {
  flex: none;
  appearance: none;
  cursor: pointer;
  padding: 7px 15px;
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 1px;
  color: rgb(var(--c-hi));
  border: 1px solid rgb(var(--c-rivet) / 0.5);
  border-radius: 999px;
  background: linear-gradient(180deg, rgb(var(--c-brass) / 0.34), rgb(var(--c-copper) / 0.24));
  transition: transform 0.18s, box-shadow 0.2s, filter 0.2s;
}
.search-btn:hover { transform: translateY(-1px); box-shadow: 0 0 16px rgb(var(--c-brass-hi) / 0.3); }
.search-btn:active { transform: translateY(0); }

.search-clear {
  flex: none;
  appearance: none;
  width: 22px;
  height: 22px;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  line-height: 1;
  color: var(--text-dim);
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  background: rgb(var(--c-ink) / 0.7);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.search-clear:hover { color: #ffd9d2; border-color: var(--danger); background: rgb(217 83 79 / 0.2); }
.search-clear[hidden] { display: none; }
@media (max-width: 700px) {
  .search-box { margin-left: 0; }
  .search-box input { width: 140px; }
}

.page-info {
  color: rgb(var(--c-rivet));
  font-size: 11.5px;
  letter-spacing: 1px;
  border: 1px solid rgb(var(--c-brass) / 0.5);
  border-radius: 999px;
  padding: 4px 12px;
  min-width: 96px;
  text-align: center;
  background: linear-gradient(180deg, rgb(var(--c-brass) / 0.18), rgba(0, 0, 0, 0.28));
  box-shadow: inset 0 1px 0 rgb(var(--c-hi) / 0.22);
}

/* ============================ 按钮（冲压金属） ============================ */

.btn {
  appearance: none;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--text);
  background: linear-gradient(180deg, rgb(var(--c-panel-hi) / 0.92), rgb(var(--c-panel) / 0.96));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 1px 0 rgb(var(--c-rivet) / 0.14), inset 0 -2px 6px rgba(0, 0, 0, 0.42), 0 3px 10px rgba(0, 0, 0, 0.4);
  transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s, filter 0.2s;
}

.btn:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: linear-gradient(180deg, rgb(var(--c-panel-hi) / 0.95), rgb(var(--c-panel-hi) / 0.98));
}
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* 主按钮：抛光黄铜 */
/* 主按钮（含四个「＋ 添加」按钮）：配色与选中的 TAB 完全一致
   —— 半透明金铜底 + 亮色字 + 内高光 + 外发光 */
.btn.primary {
  color: rgb(var(--c-hi));
  font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(180deg, rgb(var(--c-brass) / 0.34), rgb(var(--c-copper) / 0.24));
  border-color: rgb(var(--c-rivet) / 0.5);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  box-shadow:
    inset 0 1px 0 rgb(var(--c-hi) / 0.35),
    0 0 18px rgb(var(--c-brass-hi) / 0.22);
}
.btn.primary:hover:not(:disabled) {
  transform: translateY(-2px);
  background: linear-gradient(180deg, rgb(var(--c-brass) / 0.46), rgb(var(--c-copper) / 0.32));
  border-color: rgb(var(--c-rivet) / 0.75);
  box-shadow:
    inset 0 1px 0 rgb(var(--c-hi) / 0.45),
    0 0 26px rgb(var(--c-brass-hi) / 0.34);
}
.btn.primary:active:not(:disabled) { transform: translateY(0); }

.btn.ghost { background: linear-gradient(180deg, rgb(var(--c-panel-hi) / 0.7), rgb(var(--c-ink) / 0.8)); }
.btn.block { display: block; width: 100%; margin-bottom: 8px; }

/* 危险操作（删除 / 覆盖）：暗红冲压板 */
.btn.danger {
  background: linear-gradient(180deg, #e0705f, #a8342a 55%, #7d2018);
  color: #fff2ef;
  font-weight: 700;
  letter-spacing: 2px;
  border-color: rgba(255, 190, 180, 0.5);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 210, 0.5),
    inset 0 -3px 8px rgba(0, 0, 0, 0.4),
    0 5px 16px rgba(0, 0, 0, 0.5);
}
.btn.danger:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 210, 0.55),
    inset 0 -3px 8px rgba(0, 0, 0, 0.4),
    0 9px 22px rgba(0, 0, 0, 0.55),
    0 0 24px rgba(255, 90, 70, 0.4);
}
.btn.danger:active:not(:disabled) { transform: translateY(0); }

/* ============================ 网格 ============================ */

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));   /* 悬赏：每排 4 条 */
  gap: 14px;
}

/* 协会照片 / 角色卡：每排 6 张，不分页（往下滚动看更多） */
.grid-photo,
.grid-card { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.item {
  position: relative;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow);
  background-color: var(--bg-panel);
  background-image: linear-gradient(180deg, rgb(var(--c-panel-hi) / 0.94), rgb(var(--c-ink) / 0.96));
  animation: cardIn 0.45s ease backwards;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

.item:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lift);
}

.item img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: rgb(var(--c-ink));
  transition: transform 0.35s, filter 0.35s;
}
.item:hover img { transform: scale(1.05); filter: sepia(0.14) saturate(1.08); }

/* 角色卡是人物立绘，用竖版比例更合适 */
.grid-card .item img { aspect-ratio: 3 / 4; }

.card-name {
  position: relative;              /* 双重保险：永远画在图片之上 */
  z-index: 1;
  padding: 10px 12px;
  font-size: 16px;                 /* 标题放大一点（原 13.5px） */
  line-height: 1.5;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: linear-gradient(180deg, rgb(var(--c-panel-hi) / 0.9), rgb(var(--c-ink) / 0.95));
  border-top: 1px solid var(--line-soft);
  color: var(--brass-light);
}

.badge {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 2;
  font-size: 11.5px;
  letter-spacing: 2px;
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgb(var(--c-brass) / 0.28), rgba(0, 0, 0, 0.5));
  border: 1px solid rgb(var(--c-rivet) / 0.5);
  color: rgb(var(--c-rivet));
  box-shadow: inset 0 1px 0 rgb(var(--c-hi) / 0.3);
}

/* 故事接龙卡片：文字预览区（做旧黄铜压印） */
.story-body {
  aspect-ratio: 1 / 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background:
    radial-gradient(120% 80% at 100% 0%, rgb(var(--c-brass-hi) / 0.18), transparent 60%),
    linear-gradient(160deg, rgb(var(--c-brass) / 0.16), rgb(var(--c-panel) / 0.5));
}
.story-body h4 {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: 1px;
  color: rgb(var(--c-hi));
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 正文预览：第一段开头 …… 最后一段结尾，填满标题与页脚之间的整块空间 */
.story-preview {
  flex: 1;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.75;
  color: var(--text);
  word-break: break-word;
}

/* 只有一段：整段直接排满 */
.preview-single {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 8;
}

/* 多段：开头 / 省略号 / 结尾 三块 */
.preview-multi { display: flex; flex-direction: column; gap: 4px; }
.preview-multi .sp-head,
.preview-multi .sp-tail {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.preview-multi .sp-head { -webkit-line-clamp: 3; }
.preview-multi .sp-tail { -webkit-line-clamp: 4; }
.preview-multi .sp-dots {
  flex: none;
  text-align: center;
  letter-spacing: 6px;
  line-height: 1.2;
  color: var(--text-dim);
}

.story-empty { color: var(--text-dim); }

.story-by {
  margin-top: auto;
  font-size: 11.5px;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  opacity: 0.8;
}

/* 有人正在接龙：整张卡描一圈淡绿光，不在左上角压住标题 */
.item[data-locked] {
  border-color: rgba(150, 240, 200, 0.55);
  box-shadow: var(--shadow), 0 0 16px rgba(90, 200, 150, 0.28);
}
.story-by.is-locked { color: #d6ffe9; opacity: 1; }

.story-lock {
  margin: 10px 0 0;
  padding: 8px 12px;
  border: 1px solid rgba(150, 240, 200, 0.4);
  border-radius: var(--radius-sm);
  background: rgba(40, 90, 70, 0.28);
  color: #d6ffe9;
  font-size: 13px;
  letter-spacing: 0.5px;
}

/* ---------- 故事接龙：段落列表（每段带作者，谁写的看得清清楚楚） ---------- */

.story-note {
  margin: 0 0 12px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.seg-list { display: flex; flex-direction: column; gap: 12px; }

.seg {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: rgb(var(--c-ink) / 0.7);
  overflow: hidden;
}

.seg-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  background: linear-gradient(180deg, rgb(var(--c-brass) / 0.14), rgba(0, 0, 0, 0.2));
  border-bottom: 1px solid var(--line-soft);
}

.seg-no { font-size: 13px; font-weight: 600; letter-spacing: 1px; color: var(--brass-light); }
.seg-by { margin-left: auto; font-size: 12px; color: var(--text-dim); }

.seg-text {
  margin: 0;
  padding: 12px 14px;
  font-size: 14.5px;
  line-height: 1.9;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* 接龙表单里展示的「上一段」 */
.seg-prev { opacity: 0.72; margin: 4px 0 16px; }

/* 图片容器：给右下角的爱心当定位参照；裁剪放大效果，别盖住下面的标题 */
.card-media { position: relative; display: block; line-height: 0; overflow: hidden; }

/* 内容刷新时不重播入场动画（否则点个赞整片卡片都会跳一下） */
[data-grid].no-anim .item,
[data-grid].no-anim .message { animation: none; }

/* 点赞：角色卡图片右下角的小爱心，默认隐藏，鼠标移到卡片上才出现 */
.like-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.35;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  color: #ffdede;
  background: rgb(var(--c-ink) / 0.66);
  border: 1px solid rgba(255, 150, 150, 0.3);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;                    /* 隐藏时不响应点击 */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s, opacity 0.2s, background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s;
}

/* 鼠标移到卡片上 → 显示爱心 */
.item:hover .like-btn { opacity: 1; pointer-events: auto; }

/* 触屏设备没有 hover，就一直显示 */
@media (hover: none) {
  .like-btn { opacity: 1; pointer-events: auto; }
}
.like-btn:hover {
  transform: scale(1.08);
  color: #fff;
  background: rgba(72, 24, 22, 0.82);
  border-color: rgba(255, 130, 130, 0.65);
}
.like-btn:active { transform: scale(0.95); }

/* 已点赞：红底 + 心跳光晕 */
.like-btn.is-liked {
  color: #fff;
  background: linear-gradient(180deg, rgba(206, 66, 60, 0.92), rgba(140, 30, 28, 0.94));
  border-color: rgba(255, 180, 180, 0.7);
  box-shadow: 0 0 14px rgba(255, 90, 90, 0.5), inset 0 1px 0 rgba(255, 220, 220, 0.35);
}

/* 删除按钮：红色阀门 */
.del {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 3;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 200, 190, 0.35);
  background: linear-gradient(180deg, rgba(120, 50, 40, 0.85), rgba(60, 22, 18, 0.9));
  color: #ffd9d2;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  box-shadow: inset 0 1px 0 rgba(255, 220, 210, 0.25);
  transition: opacity 0.18s, filter 0.18s, border-color 0.18s;
}
.item:hover .del, .message:hover .del { opacity: 1; }
.del:hover { filter: brightness(1.25); border-color: var(--danger); }

/* ============================ 照片寄语 ============================ */

/* 有寄语时：图片下方约四分之一处压一层半透明黑幕显示寄语；没寄语就完全不渲染 */
.photo-note {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 25%;                       /* 图片下方四分之一 */
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
  animation: noteIn 0.3s ease both;
  /* 让它成为「尺寸容器」：里面的字号可以用 cqh（黑幕自身高度的百分比）来算，
     这样详情弹窗大、字就大，弹窗小、字就小，不用写死像素 */
  container-type: size;
}
@keyframes noteIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.photo-note p {
  position: relative;
  z-index: 2;
  margin: 0;
  max-height: 100%;
  /* 艺术字：优先行楷 / 隶书，缺字体就退回楷体、再退回站点衬线字体 */
  font-family: 'STXingkai', '华文行楷', 'LiSu', '隶书', 'KaiTi', '楷体', var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1em;             /* 用 em：字号变大时字距跟着放大 */
  line-height: 1.5;
  text-align: center;
  white-space: pre-wrap;             /* 寄语里的换行保留 */
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;             /* 卡片里最多 3 行 */
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* 描金渐变裁字 + 外发光。
     这里必须用 filter 而不是 text-shadow —— 字被裁成透明后 text-shadow 会从字形里透出来 */
  background-image: linear-gradient(180deg, #fffdf2 0%, #ffe9a8 36%, #f0bc45 64%, #fff6d8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 7px rgba(255, 214, 120, 0.5));
}

/* 寄语上闪烁的小星星 */
.note-star {
  position: absolute;
  z-index: 1;
  font-size: var(--star-size, 10px);
  line-height: 1;
  font-style: normal;
  color: #fff8de;
  pointer-events: none;
  opacity: 0;
  text-shadow: 0 0 6px rgba(255, 232, 165, 0.95), 0 0 13px rgba(255, 198, 90, 0.6);
  animation-name: starTwinkle;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-duration: var(--star-dur, 3s);
  animation-delay: var(--star-delay, 0s);
}
@keyframes starTwinkle {
  0%, 100% { opacity: 0; transform: scale(0.45) rotate(0deg); }
  50%      { opacity: 1; transform: scale(1.15) rotate(25deg); }
}

/* 放大详情里寄语更大，星星也跟着放大 */
.photo-note.is-detail .note-star { font-size: calc(var(--star-size, 10px) * 1.7); }

/* 系统开了「减少动态效果」就让星星常亮不闪 */
@media (prefers-reduced-motion: reduce) {
  .note-star { animation: none; opacity: 0.9; transform: none; }
}

/* 放大详情：黑幕贴在图片本身的下四分之一（靠这层相对定位的包裹） */
.lightbox-wrap {
  position: relative;
  display: inline-block;
  line-height: 0;
  max-width: 100%;
}
/* 详情弹窗里：字号按黑幕自身高度算（23cqh = 黑幕高度的 23%），上下留个夹取
   黑幕高 = 图片高的 1/4，所以图片显示得越大字越大；图小的时候也不会小到看不清 */
.photo-note.is-detail p {
  font-size: clamp(13px, 23cqh, 34px);
  -webkit-line-clamp: 3;             /* 黑幕只有四分之一高，最多 3 行 */
}

@media (max-width: 700px) {
  .photo-note p { font-size: 11.5px; }
}

/* ============================ 上传照片弹窗 ============================ */

.photo-pick { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.photo-pick-hint { font-size: 13px; color: var(--text-dim); word-break: break-all; }

.photo-preview {
  margin-top: 12px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: rgb(var(--c-ink) / 0.6);
  text-align: center;
}
.photo-preview img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  max-height: 260px;
  border-radius: 6px;
  object-fit: contain;
}

/* 超字数时的红框警示（寄语超过 30 字） */
.form-row textarea.is-over,
.form-row textarea.is-over:focus {
  border-color: var(--danger);
  background: rgb(217 83 79 / 0.12);
  box-shadow:
    inset 0 2px 7px rgba(0, 0, 0, 0.55),
    0 0 0 3px rgb(217 83 79 / 0.22),
    0 0 16px rgb(217 83 79 / 0.35);
  animation: noteShake 0.32s ease-in-out;
}
@keyframes noteShake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

/* 超字数时右下角的小计数（正常时不显示） */
.note-len {
  display: none;
  margin-top: 6px;
  text-align: right;
  font-size: 12.5px;
  letter-spacing: 0.5px;
  color: var(--danger);
}

/* ============================ 右下角聊天按钮 ============================ */

.chat-fab {
  position: fixed;
  right: 22px;
  bottom: calc(22px + var(--legal-h));   /* 抬到备案条上方 */
  z-index: 82;                       /* 在顶栏之上、弹窗之下（开弹窗时会被盖住，符合"专心处理弹窗"）*/
  width: 58px;
  height: 58px;
  padding: 0;
  overflow: hidden;                  /* 让图片被圆角裁掉 */
  cursor: pointer;
  border: 1px solid var(--line-strong);
  border-radius: 16px;               /* 正方形 + 四角圆 */
  background-color: var(--bg-panel-solid);
  box-shadow: var(--shadow-panel), 0 0 22px rgb(var(--c-brass-hi) / 0.28);
  transition: transform 0.2s, box-shadow 0.24s, opacity 0.22s;
}
.chat-fab img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;                 /* 图片是正方形，正好铺满不变形 */
  transition: transform 0.3s ease;
}
.chat-fab:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-panel), 0 0 30px rgb(var(--c-brass-hi) / 0.45);
}
.chat-fab:hover img { transform: scale(1.08); }
.chat-fab:active { transform: translateY(0); }

/* 面板打开时把按钮收起来，免得两个叠在一起 */
.chat-fab.is-hidden { opacity: 0; transform: scale(0.8) translateY(10px); pointer-events: none; }

/* ============================ 聊天面板（屏幕居中，从下往上淡入升起） ============================ */

.chat-backdrop {
  position: fixed;
  inset: 0;
  z-index: 81;
  background: rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.chat-backdrop.is-open { opacity: 1; }

.chat-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 83;
  width: min(860px, 94vw);
  height: min(760px, 88vh);
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background-color: var(--bg-panel-solid);
  background-image: var(--rivets), var(--panel-face);
  background-repeat: no-repeat;
  box-shadow: var(--shadow-panel), 0 30px 70px rgba(0, 0, 0, 0.7);
  /* 面板里的滚动不许带动背后的网页 */
  overscroll-behavior: contain;
  /* 收起态：位置在中心下方 70px，略小一点、透明 —— 展开时向上"升"到位 */
  transform: translate(-50%, calc(-50% + 70px)) scale(0.97);
  opacity: 0;
  transition: transform 0.36s cubic-bezier(0.22, 0.9, 0.3, 1), opacity 0.28s ease;
}
.chat-panel.is-open { transform: translate(-50%, -50%) scale(1); opacity: 1; }

/* 三个视图（聊天 / 生成角色 / 角色详情）互相切换 */
.chat-view { display: none; flex: 1; min-width: 0; min-height: 0; }
.chat-view.is-on { display: flex; }

/* 左边：对话主体 */
.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* 右边：角色竖栏 */
.chat-side {
  flex: none;
  width: 236px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 12px;
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, rgb(var(--c-ink) / 0.30), rgb(var(--c-ink) / 0.55));
}
.chat-side-btn { width: 100%; padding: 10px 8px; }
.chat-side-title {
  font-size: 12.5px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  padding-left: 2px;
}
.chat-roles {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;      /* 角色列表滚到底也不带动网页 */
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}
.chat-roles-empty {
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--text-dim);
  opacity: 0.8;
  padding: 8px 2px;
}

/* 竖栏里的角色条目 */
.role-card {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  appearance: none;
  font-family: inherit;
  color: var(--text);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgb(var(--c-panel-hi) / 0.55), rgb(var(--c-ink) / 0.6));
  transition: border-color 0.2s, transform 0.18s, box-shadow 0.2s;
}
.role-card:hover {
  border-color: var(--line-strong);
  transform: translateX(2px);
  box-shadow: 0 0 16px rgb(var(--c-brass-hi) / 0.18);
}
.role-card.is-mine { border-color: rgb(var(--c-brass) / 0.55); }
/* 正在聊的那个角色：高亮一下，再点它不会重复进入 */
.role-card.is-active {
  border-color: rgb(var(--c-brass-hi) / 0.8);
  background: linear-gradient(180deg, rgb(var(--c-brass) / 0.24), rgb(var(--c-ink) / 0.62));
  box-shadow: 0 0 16px rgb(var(--c-brass-hi) / 0.28);
}
.role-card.is-active .role-card-tags { color: var(--brass-light); }

/* 热度前三名：卡片右侧只挂一个 hot 图标（不显示数字、不显示悬浮文字） */
.role-hot {
  flex: none;
  margin-left: auto;
  padding-left: 6px;
  display: inline-flex;
  align-items: center;
}
.role-hot img {
  width: 17px;
  height: 17px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 0 5px rgba(255, 90, 60, 0.55));
}
.role-card-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.role-card-name {
  font-size: 13.5px;
  letter-spacing: 0.5px;
  color: rgb(var(--c-hi));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.role-card-tags {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 头像槽（图片或首字占位） */
.role-ava-slot, .role-ava {
  flex: none;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  color: var(--on-brass);
  background: var(--brass-plate);
  box-shadow: inset 0 1px 0 rgb(var(--c-hi) / 0.6);
}
.role-ava-slot img, .role-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.role-ava-slot.is-big { width: 64px; height: 64px; font-size: 24px; }

/* ============================ 角色页面（生成 / 详情）============================ */

.role-page {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;      /* 角色页滚到底也不带动网页 */
}
.role-page-head { display: flex; align-items: center; gap: 12px; }
.role-page-head.is-right { justify-content: space-between; }
.role-page-title { font-size: 17px; letter-spacing: 2px; color: rgb(var(--c-hi)); }

.role-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgb(var(--c-brass) / 0.10), rgb(var(--c-ink) / 0.45));
}
.role-hero-text { min-width: 0; }
.role-hero-name { font-size: 19px; letter-spacing: 2px; color: rgb(var(--c-hi)); word-break: break-all; }
.role-hero-sub { margin-top: 4px; font-size: 12px; color: var(--text-dim); }

.role-field-label { font-size: 13.5px; letter-spacing: 1px; color: var(--text-dim); }
.role-field-label em { font-style: normal; font-size: 12px; opacity: 0.75; }

.role-input {
  width: 100%;
  flex: 1 1 auto;                    /* 吃掉剩余高度：一路撑到下面按钮的上方 */
  min-height: 180px;
  resize: vertical;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  background: rgb(var(--c-ink) / 0.75);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  outline: none;
  box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.55);
  transition: border-color 0.2s, box-shadow 0.2s;
  overscroll-behavior: contain;      /* 里面滚到底也别带动网页 */
}
.role-input:focus { border-color: var(--brass); box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.55), 0 0 0 3px rgb(var(--c-brass) / 0.18); }
.role-input.is-over { border-color: var(--danger); box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.55), 0 0 0 3px rgb(217 83 79 / 0.22); }

.role-hint { font-size: 12px; color: var(--text-dim); line-height: 1.8; }
.role-hint code {
  font-family: Consolas, 'Courier New', monospace;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 1px 6px;
}
.role-page-actions {
  margin-top: auto;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
/* 删除是危险操作，单独靠左摆，和右边的取消/保存拉开距离 */
.role-page-actions .btn.danger { margin-right: auto; }

/* 标签文字统一白色（底色各不相同，白字配深色投影更清楚） */
.role-tag {
  display: inline-block;
  padding: 4px 12px;
  font-size: 12.5px;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: default;
  transition: filter 0.2s;
}
.role-tag:hover { animation: tagWiggle 0.46s ease-in-out; filter: brightness(1.15); }
@keyframes tagWiggle {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(-5deg); }
  75%      { transform: rotate(5deg); }
}
.tag-c0 { background: linear-gradient(180deg, #c9a227, #8f6f12); border-color: rgba(255, 245, 200, 0.45); }
.tag-c1 { background: linear-gradient(180deg, #c0563d, #8a3524); border-color: rgba(255, 220, 200, 0.4); }
.tag-c2 { background: linear-gradient(180deg, #4e9c78, #2d6b4f); border-color: rgba(215, 255, 230, 0.4); }
.tag-c3 { background: linear-gradient(180deg, #5b8cff, #3358c4); border-color: rgba(220, 230, 255, 0.4); }
.tag-c4 { background: linear-gradient(180deg, #9b5fd0, #67348f); border-color: rgba(240, 220, 255, 0.4); }
.tag-c5 { background: linear-gradient(180deg, #d08a2e, #8f5a12); border-color: rgba(255, 240, 210, 0.4); }
.tag-c6 { background: linear-gradient(180deg, #3aa8a0, #1f6b66); border-color: rgba(215, 255, 250, 0.4); }
.tag-c7 { background: linear-gradient(180deg, #c04a6e, #822a45); border-color: rgba(255, 220, 230, 0.4); }

.role-desc {
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--text);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: rgb(var(--c-ink) / 0.5);
  word-break: break-word;
  white-space: pre-wrap;
}

/* 面板头：像 QQ 的会话标题栏 */
.chat-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgb(var(--c-brass) / 0.14), transparent);
}
.chat-head-ava {
  flex: none;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;                  /* 角色头像裁成圆形，别铺开 */
  font-size: 17px;
  color: var(--on-brass);
  background: var(--brass-plate);
  box-shadow: inset 0 1px 0 rgb(var(--c-hi) / 0.65);
}
.chat-head-ava img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}
.chat-head-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; margin-right: auto; }
.chat-name { font-size: 16px; letter-spacing: 1.5px; color: rgb(var(--c-hi)); }
.chat-sub { font-size: 11.5px; color: var(--text-dim); }
.chat-close {
  flex: none;
  appearance: none;
  width: 28px;
  height: 28px;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-dim);
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  background: rgb(var(--c-ink) / 0.5);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.chat-close:hover { color: #ffd9d2; border-color: var(--danger); background: rgb(217 83 79 / 0.18); }

/* 消息舞台：消息区 + 盖在上面的加载遮罩 */
.chat-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}

/* 面板内的提示条：贴在头像栏下方居中显示（不再用屏幕底部那个全局提示） */
.chat-tip {
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 6;
  max-width: calc(100% - 28px);
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 1px;
  line-height: 1.6;
  text-align: center;
  color: rgb(var(--c-hi));
  background: linear-gradient(180deg, rgb(var(--c-brass) / 0.30), rgb(var(--c-ink) / 0.92));
  border: 1px solid rgb(var(--c-brass-hi) / 0.55);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55), 0 0 18px rgb(var(--c-brass-hi) / 0.22);
  pointer-events: none;
  transform: translateX(-50%);
  opacity: 0;
}
.chat-tip.is-on { animation: chatTipIn 0.22s ease both; }
.chat-tip.is-err {
  color: #ffe2dd;
  background: linear-gradient(180deg, rgb(217 83 79 / 0.55), rgb(var(--c-ink) / 0.92));
  border-color: rgb(217 83 79 / 0.8);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55), 0 0 18px rgb(217 83 79 / 0.35);
}
@keyframes chatTipIn {
  from { opacity: 0; transform: translate(-50%, -9px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* 等 AI 回复时盖住的白色遮罩 + 转圈读取符号
   透明度别调太高，不然从深色面板切过去像闪光弹 ✧ */
.chat-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.38);      /* 0.84 → 0.38，淡很多 */
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: chatVeilIn 0.18s ease both;
}
@keyframes chatVeilIn { from { opacity: 0; } to { opacity: 1; } }

/* 底变淡以后深色字看不清了，换成白字 + 投影 */
.chat-loading-text {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 14px rgba(0, 0, 0, 0.55);
}

.chat-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(0, 0, 0, 0.22);
  border-top-color: #fff;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.75));
  animation: chatSpin 0.78s linear infinite;
}
@keyframes chatSpin { to { transform: rotate(360deg); } }

/* 「查看更早」按钮：贴在消息区顶部，虚线圈，不抢眼 */
.chat-earlier {
  align-self: center;
  flex: none;
  margin: 0 0 4px;
  padding: 7px 16px;
  cursor: pointer;
  appearance: none;
  font-family: inherit;
  font-size: 12.5px;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  border: 1px dashed var(--line);
  border-radius: 999px;
  background: rgb(var(--c-ink) / 0.5);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.chat-earlier:hover {
  color: var(--brass-light);
  border-color: rgb(var(--c-brass) / 0.6);
  background: rgb(var(--c-ink) / 0.72);
}
.chat-earlier-sub { opacity: 0.72; margin-left: 2px; }

/* 消息区 */
.chat-body {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;      /* 消息滚到底也不带动网页 */
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-time { text-align: center; font-size: 11.5px; letter-spacing: 1px; color: var(--text-dim); }

/* 没选角色时的温馨提示：长句要能自动换行、居中，手机上不能被撑出屏幕 */
.chat-empty-tip {
  display: block;
  max-width: 100%;
  padding: 0 22px;
  text-align: center;
  line-height: 1.95;
  word-break: break-word;
  color: rgb(var(--c-hi));
  opacity: 0.92;
}

/* 没有消息时的空状态（有消息后由脚本隐藏） */
.chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13.5px;
  letter-spacing: 1px;
  color: var(--text-dim);
  opacity: 0.75;
}

.chat-msg { display: flex; align-items: flex-start; gap: 8px; }
.chat-msg.is-me { justify-content: flex-end; }
.chat-ava {
  flex: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 14px;
  color: rgb(var(--c-hi));
  background: linear-gradient(180deg, rgb(var(--c-panel-hi) / 0.95), rgb(var(--c-panel) / 0.95));
  border: 1px solid var(--line-soft);
}
.chat-ava.is-me { color: var(--on-brass); background: var(--brass-plate); border-color: transparent; }

.chat-bubble {
  max-width: 74%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
  white-space: pre-wrap;
}
.chat-msg.is-other .chat-bubble {
  color: var(--text);
  background: linear-gradient(180deg, rgb(var(--c-panel-hi) / 0.95), rgb(var(--c-panel) / 0.95));
  border: 1px solid var(--line-soft);
  border-top-left-radius: 4px;       /* 气泡朝头像那侧收一个角 */
}
.chat-msg.is-me .chat-bubble {
  color: #fff;                       /* 白字（原来是近黑色，看不清）*/
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
  font-weight: 600;
  /* 深色底 + 主题色罩一层：白字够清楚，又能和对方的气泡区分开 */
  background:
    linear-gradient(180deg, rgb(var(--c-brass) / 0.50), rgb(var(--c-brass-dark) / 0.85)),
    rgb(var(--c-ink) / 0.92);
  border: 1px solid rgb(var(--c-brass-hi) / 0.55);
  border-top-right-radius: 4px;
  box-shadow: inset 0 1px 0 rgb(var(--c-brass-hi) / 0.35);
}
/* 图片气泡里的文字说明也跟着变白 */
.chat-msg.is-me .chat-bubble .chat-img-cap { color: #fff; }

/* 底部输入栏 */
.chat-input {
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgb(var(--c-ink) / 0.25), rgb(var(--c-ink) / 0.55));
}
.chat-input-row { display: flex; align-items: center; gap: 8px; }

/* 待发送的图片预览 */
.chat-pending {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  padding: 6px 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: rgb(var(--c-ink) / 0.55);
}
.chat-pending img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  display: block;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
}
.chat-pending-x {
  appearance: none;
  width: 24px;
  height: 24px;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-dim);
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  background: rgb(var(--c-ink) / 0.6);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.chat-pending-x:hover { color: #ffd9d2; border-color: var(--danger); background: rgb(217 83 79 / 0.2); }

/* 发送图片按钮：用你给的 img-button 图标（白色线条图，所以配深色方底） */
.chat-img-btn {
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  appearance: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgb(var(--c-panel-hi) / 0.7), rgb(var(--c-ink) / 0.8));
  transition: transform 0.18s, box-shadow 0.2s, border-color 0.2s, opacity 0.2s;
}
.chat-img-btn img { width: 22px; height: 22px; display: block; object-fit: contain; }
.chat-img-btn:hover {
  transform: translateY(-1px);
  border-color: rgb(var(--c-brass-hi) / 0.7);
  box-shadow: 0 0 16px rgb(var(--c-brass-hi) / 0.28);
}
.chat-img-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; filter: grayscale(0.6); }

/* 气泡里的图片 */
.chat-bubble.is-img { padding: 6px; }
.chat-bubble.is-img img {
  display: block;
  max-width: 230px;
  max-height: 230px;
  border-radius: 9px;
  cursor: zoom-in;
}
.chat-bubble.is-img .chat-img-cap {
  padding: 6px 6px 2px;
  font-size: 13.5px;
  line-height: 1.6;
  color: inherit;
}

.chat-input input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: rgb(var(--c-ink) / 0.75);
  border: 1px solid var(--line);
  border-radius: 999px;              /* QQ 那种圆角输入框 */
  padding: 10px 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.chat-input input:focus {
  border-color: var(--brass);
  background: rgb(var(--c-ink) / 0.9);
  box-shadow: 0 0 0 3px rgb(var(--c-brass) / 0.18);
}
/* 没选角色时输入框置灰、不能输入 */
.chat-input input:disabled {
  color: var(--text-dim);
  background: rgb(var(--c-ink) / 0.4);
  border-color: var(--line-soft);
  box-shadow: none;
  cursor: not-allowed;
}
.chat-input input:disabled::placeholder { color: var(--text-dim); opacity: 0.85; }
.chat-send { flex: none; padding: 9px 16px; }
.chat-send:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.5); }

/* AI「编辑中…」占位气泡：文字 + 小旋转等待符号 */
.chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
}
.chat-typing-txt {
  font-size: 13.5px;
  letter-spacing: 1px;
  opacity: 0.9;
  animation: typingBreath 1.6s ease-in-out infinite;
}
@keyframes typingBreath {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}
.chat-mini-spin {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgb(var(--c-hi) / 0.22);
  border-top-color: rgb(var(--c-brass-hi));
  animation: chatSpin 0.7s linear infinite;
}
.chat-msg.is-failed .chat-bubble { border-color: var(--danger); color: #ffd9d2; }

/* 中等宽度：竖栏改成横向铺在下面，角色列表横向滚动 */
/* ---------- 手机 / 小平板：聊天面板改成上下布局 ---------- */
/* 注意：真正决定「左对话 + 右角色栏」的是 .chat-view（display:flex 的 row），
   不是 .chat-panel。之前只改了 .chat-panel，所以在手机上一直是左右排，
   角色栏被挤成一条细缝，聊天区几乎没法用。这里两层都改才生效。 */
@media (max-width: 760px) {
  .chat-panel { flex-direction: column; }
  .chat-view.is-on { flex-direction: column; }

  /* 角色栏改成顶部一条横向滑条：不再跟消息区抢 40% 的高度 */
  .chat-side {
    order: -1;
    flex: none;
    width: auto;
    max-height: none;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-left: none;
    border-top: none;
    border-bottom: 1px solid var(--line);
  }
  .chat-side-title { display: none; }              /* 手机上省掉标题，省一行高度 */
  .chat-side-btn { width: auto; flex: none; padding: 7px 14px; font-size: 13px; }
  .chat-roles {
    flex: 1;
    min-width: 0;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    gap: 6px;
  }
  .role-card { width: auto; flex: none; max-width: 150px; padding: 6px 9px; gap: 7px; }
  .role-card-tags { display: none; }               /* 手机上省掉热度标签，名字更重要 */
}

/* 窄屏：面板铺满，更像手机上的聊天页 */
@media (max-width: 520px) {
  .chat-fab { right: 16px; bottom: calc(16px + var(--legal-h)); width: 54px; height: 54px; border-radius: 14px; }
  .chat-panel {
    width: 100%;
    height: 90vh;
    border-radius: var(--radius) var(--radius) 0 0;
    transform: translate(-50%, calc(-50% + 40px)) scale(0.99);
  }
  .chat-panel.is-open { transform: translate(-50%, -50%) scale(1); }
  .role-page { padding: 14px 14px 16px; }
}

/* ============================ 右下角聊天按钮结束 ============================ */


/* ============================ 注册审核（近全屏） ============================ */

.modal-box.is-review {
  width: min(1180px, 96vw);
  height: 88vh;                      /* 基本盖满整页 */
  max-height: 88vh;
  padding: 0;                        /* 里面自己排头部和列表 */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* 头部已经有「关闭」按钮了，右上角那个 ✕ 会和它打架，隐藏掉（Esc 照样能关） */
.modal-box.is-review .modal-close { display: none; }

.review-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgb(var(--c-brass) / 0.10), transparent);
}
.review-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 3px;
  color: rgb(var(--c-hi));
}
.review-head-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.review-count { font-size: 13px; letter-spacing: 1px; color: var(--brass-light); }

.review-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.review-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgb(var(--c-panel-hi) / 0.5), rgb(var(--c-ink) / 0.6));
  animation: noteIn 0.25s ease both;
}
.review-who { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 220px; }
.review-name { font-size: 17px; letter-spacing: 1px; color: rgb(var(--c-hi)); word-break: break-all; }
.review-time { font-size: 12.5px; color: var(--text-dim); }
.review-btns { display: flex; gap: 10px; margin-left: auto; }

.review-empty { text-align: center; margin: 48px auto; color: var(--text-dim); font-size: 14px; line-height: 1.9; }
.review-empty-ico { font-size: 42px; color: rgb(var(--c-brass-hi)); margin-bottom: 8px; }
.review-empty-sub { font-size: 12.5px; opacity: 0.8; margin-top: 4px; }

/* ---------- 账号管理页（沿用审核页骨架：头部 + 可滚动列表）---------- */

.acct-who { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 220px; }
.acct-ava {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--on-brass);
  background: var(--brass-plate);
  box-shadow: inset 0 1px 0 rgb(var(--c-hi) / 0.5);
}
.acct-text { min-width: 0; }
.acct-name {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 15px;
  letter-spacing: 0.5px;
  color: rgb(var(--c-hi));
  word-break: break-all;
}
.acct-tag {
  flex: none;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.5px;
  border: 1px solid transparent;
}
.acct-tag.is-admin { color: #2a1c05; background: linear-gradient(180deg, #f0d38a, #c9a227); border-color: rgba(255, 245, 200, 0.5); }
.acct-tag.is-banned { color: #fff; background: linear-gradient(180deg, #c0563d, #8a3524); border-color: rgba(255, 220, 200, 0.45); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.acct-tag.is-me { color: var(--text-dim); background: rgb(var(--c-ink) / 0.7); border-color: var(--line-soft); }
.acct-self { font-size: 12.5px; letter-spacing: 0.5px; color: var(--text-dim); }

/* 被封禁的账号整行标红 */
.review-row.is-banned {
  border-color: rgb(217 83 79 / 0.55);
  background: linear-gradient(180deg, rgb(217 83 79 / 0.12), rgb(var(--c-ink) / 0.62));
}

/* 账号弹窗里的审核入口 + 待审核数量角标 */
.review-badge {
  display: inline-block;
  margin-left: 8px;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 12px;
  text-align: center;
  color: var(--on-brass);
  background: rgb(var(--c-hi));
}

.form-row > span em { font-style: normal; font-size: 12px; opacity: 0.75; }

/* 删除按钮只出现在「自己发布的内容」上（后端也会再校验一次） */
.item .del, .message .del { display: none; }
.item[data-own] .del, .message[data-own] .del { display: block; }

/* ============================ 留言墙（一条占满一整排） ============================ */

.list { display: flex; flex-direction: column; gap: 12px; }

.message {
  position: relative;
  padding: 16px 56px 16px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  background-color: var(--bg-panel);
  background-image: var(--rivets), linear-gradient(180deg, rgb(var(--c-panel-hi) / 0.95), rgb(var(--c-ink) / 0.97));
  background-repeat: no-repeat;
  cursor: pointer;
  animation: cardIn 0.45s ease backwards;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

/* 左侧黄铜铆钉列 */
.message::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 99px;
  background: linear-gradient(180deg, rgb(var(--c-rivet) / 0.65), rgb(var(--c-copper) / 0.5));
  box-shadow: 0 0 8px rgb(var(--c-brass-hi) / 0.35);
}

.message:hover {
  transform: translateX(5px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lift);
}

.message h4 { margin: 0 0 6px; font-size: 17px; letter-spacing: 1px; color: rgb(var(--c-hi)); }

.msg-preview {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.msg-time { margin-top: 8px; font-size: 12px; color: var(--text-dim); opacity: 0.75; }

/* ============================ 空状态 ============================ */

.empty {
  display: none;
  margin: 30px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  letter-spacing: 1px;
}
.empty.show { display: block; }
.empty::before { content: "⚙ "; color: var(--brass); }

/* ============================ 模态框 ============================ */

.modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(var(--c-ink) / 0.82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-box {
  position: relative;
  z-index: 1;
  width: min(600px, 94vw);          /* 详情 / 账号等普通弹窗 */
  max-width: 96vw;
  max-height: 92vh;
  /* 滚动交给里面的 .modal-body，这样右上角的 ✕ 不会跟着内容滚走 */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 26px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel), 0 0 40px rgb(var(--c-brass-hi) / 0.14);
  background-color: var(--bg-panel-solid);
  background-image: var(--rivets), var(--panel-face);
  background-repeat: no-repeat;
  animation: modalIn 0.24s ease;
}

/* 真正滚动的那一层 */
.modal-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
/* 审核页自己分段滚动（头固定 + 列表滚动），它内层就不要再滚了 */
.modal-box.is-review .modal-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 添加 / 编辑表单：整体放大，填写更舒服 */
.modal-box.is-form {
  width: min(880px, 94vw);
  padding: 30px 36px 34px;
}
.modal-box.is-form .modal-title { font-size: 22px; margin-bottom: 22px; }

/* 图片预览：宽度交给图片自己决定，不套固定宽度 */
.modal-box.is-photo { width: auto; max-width: min(1100px, 96vw); }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.modal-close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgb(var(--c-panel-hi) / 0.9), rgb(var(--c-panel) / 0.95));
  color: var(--brass-light);
  cursor: pointer;
  z-index: 2;
  transition: border-color 0.18s, filter 0.18s;
}
.modal-close:hover { border-color: var(--danger); filter: brightness(1.2); color: #ffd9d2; }

.modal-title {
  margin: 0 0 16px;
  font-size: 19px;
  letter-spacing: 2px;
  color: rgb(var(--c-hi));
  padding-right: 34px;
}
.modal-title::before { content: "⚙ "; color: var(--brass); }

.lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 82vh;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgb(var(--c-ink));
  box-shadow: 0 0 44px rgb(var(--c-brass-hi) / 0.25);
}

.detail img {
  display: block;
  width: 100%;
  max-height: 58vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgb(var(--c-ink));
  margin-bottom: 14px;
}

.detail-text {
  white-space: pre-wrap;
  word-break: break-word;
  background: rgb(var(--c-ink) / 0.7);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  margin: 10px 0 0;
  font-size: 14.5px;
  line-height: 1.85;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}

.detail-time { color: var(--text-dim); font-size: 12px; margin-top: 10px; letter-spacing: 0.5px; }

/* ============================ 角色卡详情：左图 + 右信息 ============================ */

/* 角色卡详情：弹窗固定大小，图片在左栏里自己滚（超长图不再被缩小） */
.modal-box.is-card {
  width: min(920px, 94vw);
  height: min(640px, 86vh);          /* 固定高度，不跟着图片长短变 */
}
.modal-box.is-card .modal-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;                  /* 滚动交给左右两栏各自处理 */
}

.card-detail {
  display: flex;
  gap: 22px;
  align-items: flex-start;           /* 图片栏按图片高度贴合，不留大片空白 */
  flex: 1;
  min-height: 0;
}
.card-detail-media {
  position: relative;               /* 计数角标以它为定位基准，且它自己不滚 → 角标固定 */
  flex: 0 0 42%;
  max-width: 42%;
  max-height: 100%;                  /* 图比弹窗高就封顶，靠内层滚 */
  display: flex;                     /* 让内层滚动区撑满这个外框 */
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgb(var(--c-ink));
  overflow: hidden;                  /* 外框不滚（滚动交给下面那层）*/
}
/* 真正滚动的一层 */
.card-detail-scroll {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;      /* 滚到底也不带动弹窗 / 网页 */
  scrollbar-width: thin;
  scrollbar-color: rgb(var(--c-brass)) rgba(0, 0, 0, 0.35);
}
.card-detail-scroll img {
  display: block;
  width: 100%;                       /* 小图 / 扁图都会被放大到栏宽，不会缩在角落 */
  height: auto;
  max-height: none;                  /* 不再压扁，长度交给外层滚 */
  object-fit: contain;
}
/* 图片栏滚动条：细一点、跟主题配色 */
.card-detail-scroll::-webkit-scrollbar { width: 10px; }
.card-detail-scroll::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.35); border-radius: 999px; }
.card-detail-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: linear-gradient(180deg, rgb(var(--c-brass-hi) / 0.85), rgb(var(--c-brass) / 0.95));
}
.card-detail-scroll::-webkit-scrollbar-thumb:hover { filter: brightness(1.15); }

/* 详情里的「第几张 / 共几张 · 谁的」角标 */
.card-detail-count {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--text-strong);
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--line-soft);
  pointer-events: none;
}

/* ============================ 详情左右翻页箭头（超过一张才出现） ============================ */

.card-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 4px;              /* ‹ › 视觉居中补偿 */
  font-size: 26px;
  line-height: 1;
  color: var(--text-strong);
  cursor: pointer;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background-color: var(--bg-panel-solid);
  background-image: var(--panel-face);
  background-repeat: no-repeat;
  box-shadow: var(--shadow), inset 0 1px 0 rgb(var(--c-hi) / 0.14);
  transition: transform 0.18s, box-shadow 0.22s, color 0.2s, border-color 0.2s;
}
.card-nav:hover {
  color: rgb(var(--c-brass-hi));
  border-color: rgb(var(--c-brass-hi) / 0.8);
  transform: translateY(-50%) scale(1.08);
  box-shadow: var(--shadow), 0 0 22px rgb(var(--c-brass-hi) / 0.3);
}
.card-nav:active { transform: translateY(-50%) scale(0.98); }

/* 箭头放在盒子内留出的「槽位」里：
   .modal-box 有 overflow:auto，绝对定位的子元素超出盒子会被裁掉（只剩半个），
   所以不能挂到盒子外面，改成左右各让出一条 62px 的边距给箭头。 */
.modal-box.is-card.has-nav { padding-left: 62px; padding-right: 62px; }
.card-nav.prev { left: 8px; }
.card-nav.next { right: 8px; }

@media (max-width: 780px) {
  .modal-box.is-card.has-nav { padding-left: 48px; padding-right: 48px; }
  .card-nav { width: 38px; height: 38px; font-size: 21px; }
  .card-nav.prev { left: 5px; }
  .card-nav.next { right: 5px; }
}

/* ============================ 角色卡轮播 ============================ */

/* 换图时淡出淡入，不要硬切 */
.card-media img { transition: opacity 0.22s ease, transform 0.5s cubic-bezier(0.2, 0.7, 0.3, 1); }
.card-media img.is-swap { opacity: 0; }

/* 右下角「第几张 / 共几张」——放左下角，避开右下角的点赞按钮 */
.car-count {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.5px;
  line-height: 1.6;
  color: var(--text-strong);
  background: rgba(0, 0, 0, 0.58);
  border: 1px solid var(--line-soft);
  pointer-events: none;
}

/* 上传者名字：卡片正上方居中，半透明黑底（字号与 .card-name 一致） */
/* 卡片下方的作者信息：左边小头像 + 右边用户名，一起靠左 */
.card-by {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px 12px 10px;
  background: rgb(var(--c-ink) / 0.55);
}
.card-by-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.5px;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 注意：头像本身也是 .item 里的 <img>，会被上面那条
   `.item img { width: 100%; aspect-ratio: 1/1 }` 命中（那是给卡片大图用的），
   所以这里必须用更具体的选择器把它压回来，否则头像会被撑成扁椭圆、还会把用户名挤没 */
.item .card-by .card-ava {
  flex: none;
  width: 22px;
  height: 22px;
  min-width: 22px;
  max-width: 22px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--on-brass);
  background: var(--brass-plate);
  box-shadow: inset 0 1px 0 rgb(var(--c-hi) / 0.5);
}

/* 卡片上那条顶部用户名横幅已经不用了（用户名移到卡片名下面） */
.card-owner { display: none; }

.card-detail-info {
  flex: 1;
  min-width: 0;
  min-height: 0;
  align-self: stretch;               /* 右栏仍然撑满弹窗：底部按钮留在最下方 */
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;                    /* 右侧信息多了也在自己这栏滚 */
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgb(var(--c-brass)) rgba(0, 0, 0, 0.35);
}
.card-detail-name { margin: 0; padding-right: 34px; }
.card-detail-actions { margin-top: auto; }   /* 功能按钮推到右下角 */

/* ---------- 捏人码 / 服装码 TAB 切换 ---------- */

.code-tabs { display: flex; gap: 8px; }

.code-tab {
  flex: 1;
  appearance: none;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 2px;
  padding: 9px 0;
  color: var(--text-dim);
  background: linear-gradient(180deg, rgb(var(--c-panel-hi) / 0.75), rgb(var(--c-ink) / 0.85));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.code-tab:hover:not(:disabled) { color: var(--text); border-color: var(--line-strong); }
.code-tab:disabled { opacity: 0.38; cursor: not-allowed; }

.code-tab.is-active {
  color: var(--on-brass);
  font-weight: 700;
  background: var(--brass-plate);
  border-color: rgb(var(--c-hi) / 0.55);
  text-shadow: 0 1px 0 rgb(var(--c-hi) / 0.5);
  box-shadow: inset 0 1px 0 rgb(var(--c-hi) / 0.75), inset 0 -3px 8px rgba(0, 0, 0, 0.32);
}

.code-panel {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: rgb(var(--c-ink) / 0.7);
  overflow: hidden;
}
.code-panel[hidden] { display: none; }

.code-value {
  margin: 0;
  padding: 14px 16px;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
  word-break: break-all;
  white-space: pre-wrap;
  user-select: all;              /* 点一下整段选中，方便手动复制 */
}
.code-value-empty { font-family: inherit; font-size: 14px; color: var(--text-dim); }

.code-foot { display: flex; justify-content: flex-end; padding: 0 12px 12px; }
.code-copy { padding: 5px 14px; font-size: 13px; letter-spacing: 1px; }

/* ---------- 手机端卡片详情：上下堆叠 ---------- */
/* 之前这里只改了方向与宽度，图片高度没限制：
   角色卡多是竖版截图（捏人界面那种），铺满宽度后高度能到 480px 以上，
   而它是 flex:none（不收缩），于是下面的信息栏被挤成几乎 0 高度 ——
   捏人码 / 服装码就在那片区域里，看不见也滚不到。
   现在给图片栏封顶（超出在栏内滚动，和桌面行为一致），信息栏就永远有空间。 */
@media (max-width: 700px) {
  .card-detail { flex-direction: column; gap: 14px; }

  .card-detail-media {
    flex: none;
    width: 100%;
    max-width: 100%;
    max-height: 42vh;            /* ★ 关键：给信息栏留出至少一半弹窗 */
  }

  .card-detail-info {
    flex: 1 1 auto;
    min-height: 88px;            /* 兜底：绝不允许被压成 0 */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* 弹窗在手机上给高一点、内边距收一点，把宽度还给内容 */
  .modal-box.is-card {
    height: 88vh;
    max-height: 88vh;
    padding: 16px 14px;
  }
  .modal-box.is-card.has-nav {
    padding-left: 36px;          /* 只留刚好放箭头（28px）的槽位 */
    padding-right: 36px;
  }

  /* 「捏人码 / 服装码」在手机上更醒目一点 */
  .code-tabs { gap: 6px; }
  .code-tab { font-size: 13.5px; letter-spacing: 1px; padding: 10px 0; }
  .code-value { font-size: 14px; padding: 12px; line-height: 1.75; }
  .code-foot { padding: 0 12px 12px; }
}

@media (max-width: 420px) {
  /* 超窄屏再把图片收一点，信息栏多留些空间 */
  .card-detail-media { max-height: 36vh; }
  .card-detail { gap: 10px; }
  .code-value { font-size: 13.5px; }
}

.detail-actions, .form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

/* 账号弹窗：头像预览 + 信息 */
.account-top { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 18px; }

.avatar-preview {
  flex: none;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgb(var(--c-rivet) / 0.5);
  background: rgb(var(--c-ink) / 0.7);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  padding: 0;                  /* 不能留内边距，否则图片填不满圆框 */
}

/* 图片撑满整个圆框（方图 / 长图都会被裁成圆形铺满） */
.avatar-big {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
span.avatar-big {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brass-plate);
  color: var(--on-brass);
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 700;
  padding: 10px;               /* 只有文字占位时才需要留白 */
}

.account-info { flex: 1; min-width: 0; }
.avatar-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

/* ============================ 表单 ============================ */

.form-row { display: block; margin-bottom: 18px; }
.form-row > span { display: block; font-size: 14px; color: var(--text-dim); margin-bottom: 8px; letter-spacing: 1px; }

/* 文本 / 密码输入框样式保持一致 */
.form-row input[type="text"],
.form-row input[type="password"],
.form-row textarea {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: rgb(var(--c-ink) / 0.75);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  outline: none;
  resize: vertical;
  box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.55);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.form-row input[type="text"]::placeholder,
.form-row input[type="password"]::placeholder,
.form-row textarea::placeholder { color: rgb(var(--c-brass-hi) / 0.6); }
.form-row input[type="text"]:focus,
.form-row input[type="password"]:focus,
.form-row textarea:focus {
  border-color: var(--brass);
  background: rgb(var(--c-ink) / 0.9);
  box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.55), 0 0 0 3px rgb(var(--c-brass) / 0.2);
}
/* 去掉 Edge/IE 自带的密码「显示」按钮与清除按钮，保持外观统一 */
.form-row input::-ms-reveal,
.form-row input::-ms-clear { display: none; }
.form-row input[type="password"]::-webkit-credentials-auto-fill-button { visibility: hidden; }

.thumb {
  margin-top: 10px;
  min-height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 14px;
  letter-spacing: 1px;
  border: 1px dashed rgb(var(--c-brass) / 0.45);
  border-radius: var(--radius-sm);
  background: rgb(var(--c-ink) / 0.5);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.thumb img { max-width: 100%; max-height: 340px; display: block; }

/* ============================ 账号 / 登录注册 ============================ */

.auth-tabs { display: flex; gap: 8px; margin-bottom: 18px; }

.auth-tab {
  flex: 1;
  appearance: none;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 2px;
  padding: 10px 0;
  color: var(--text-dim);
  background: linear-gradient(180deg, rgb(var(--c-panel-hi) / 0.75), rgb(var(--c-ink) / 0.85));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.auth-tab:hover { color: var(--text); border-color: var(--line-strong); }

.auth-tab.is-active {
  color: var(--on-brass);
  font-weight: 700;
  background: var(--brass-plate);
  border-color: rgb(var(--c-hi) / 0.55);
  text-shadow: 0 1px 0 rgb(var(--c-hi) / 0.5);
  box-shadow: inset 0 1px 0 rgb(var(--c-hi) / 0.75), inset 0 -3px 8px rgba(0, 0, 0, 0.32);
}

.auth-tip { margin: 6px 0 0; font-size: 12.5px; color: var(--text-dim); line-height: 1.75; }

/* 未登录（访客）时：写入类操作带一把小锁 */
body.is-guest .toolbar .btn.primary::before {
  content: "🔒";
  margin-right: 7px;
  font-size: 12px;
}

body.is-guest [data-empty]::after {
  content: "（需先登录 / 注册）";
  color: var(--brass-light);
}

/* ============================ 提示条（蒸汽朋克铭牌，可叠放） ============================ */

.toast-box {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 130;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: min(560px, 92vw);
  pointer-events: none;
}

.toast {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 18px 11px 14px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: rgb(var(--c-hi));
  font-size: 14px;
  letter-spacing: 1px;
  pointer-events: auto;
  /* 左右两颗铆钉 + 冲压金属底 */
  background-color: rgb(var(--c-ink) / 0.98);
  background-image:
    radial-gradient(circle at 9px 50%, rgb(var(--c-rivet) / 0.5) 0 1.6px, rgba(0, 0, 0, 0.45) 1.6px 2.6px, transparent 2.8px),
    radial-gradient(circle at calc(100% - 9px) 50%, rgb(var(--c-rivet) / 0.5) 0 1.6px, rgba(0, 0, 0, 0.45) 1.6px 2.6px, transparent 2.8px),
    linear-gradient(180deg, rgb(var(--c-panel-hi) / 0.98), rgb(var(--c-ink) / 0.99));
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgb(var(--c-rivet) / 0.22),
    0 0 20px rgb(var(--c-brass-hi) / 0.18);
  animation: toastIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.25) both;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-10px) scale(0.97); }
}
.toast.out { animation: toastOut 0.22s ease forwards; }

.toast-ico {
  flex: none;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--brass-plate);
  color: var(--on-brass);
  font-size: 12px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgb(var(--c-hi) / 0.7);
}

.toast-msg { flex: 1; min-width: 0; word-break: break-word; }

/* 底部像压力表一样慢慢排空的进度条 */
.toast-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  transform-origin: left center;
  background: linear-gradient(90deg, rgb(var(--c-brass-hi)), rgb(var(--c-brass-hi)));
  animation-name: toastBar;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes toastBar {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* 成功语气 */
.toast-ok {
  border-color: rgba(150, 240, 200, 0.55);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(220, 255, 240, 0.22),
    0 0 20px rgba(90, 200, 150, 0.22);
}
.toast-ok .toast-ico { background: linear-gradient(180deg, #c9f5dd, #4e9c78); }
.toast-ok .toast-bar { background: linear-gradient(90deg, #4e9c78, #b9f0d0); }

/* 失败语气 */
.toast-err {
  border-color: rgba(255, 150, 150, 0.6);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 220, 215, 0.22),
    0 0 22px rgba(210, 70, 60, 0.28);
}
.toast-err .toast-ico { background: linear-gradient(180deg, #ffb3ad, #b8342a); color: #fff5f3; }
.toast-err .toast-bar { background: linear-gradient(90deg, #b8342a, #ff9d9d); }

/* ============================ 站内确认框（替代浏览器原生 confirm） ============================ */

.confirm {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.confirm[hidden] { display: none; }

.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(var(--c-ink) / 0.74);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.22s;
}
.confirm.show .confirm-backdrop { opacity: 1; }

.confirm-card {
  position: relative;
  z-index: 1;
  width: min(440px, 94vw);
  padding: 26px 28px 24px;
  text-align: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background-color: var(--bg-panel-solid);
  background-image: var(--rivets), var(--panel-face);
  background-repeat: no-repeat;
  box-shadow: var(--shadow-panel), 0 0 50px rgb(var(--c-brass-hi) / 0.18);
  opacity: 0;
  transform: translateY(18px) scale(0.95);
  transition: opacity 0.22s, transform 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.confirm.show .confirm-card { opacity: 1; transform: none; }

.confirm-title {
  margin: 0 0 12px;
  font-size: 19px;
  letter-spacing: 2px;
  color: rgb(var(--c-hi));
}
.confirm-title::before { content: "⚙ "; color: var(--brass); }

.confirm-text {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--text);
  word-break: break-word;
}

.confirm-warn {
  margin: 14px 0 0;
  font-size: 13px;
  letter-spacing: 1px;
  color: #ffb3ad;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}
.confirm-actions .btn { min-width: 108px; }

/* ============================ 无障碍 ============================ */

:focus-visible { outline: 2px solid var(--brass-light); outline-offset: 2px; }

/* ============================ 响应式 ============================ */

@media (max-width: 1500px) {
  .grid-photo, .grid-card { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 1250px) {
  .grid-photo, .grid-card { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  :root { --pad-side: 16px; }
  .app { padding: 14px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-photo, .grid-card { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .site-title { letter-spacing: 5px; }
  .brand { font-size: 15px; letter-spacing: 2px; }
}

@media (max-width: 700px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-photo, .grid-card { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { gap: 8px; }
  .pager { margin-left: 0; width: 100%; justify-content: space-between; }
  .tabs { width: 100%; border-radius: var(--radius); }
  .site-title { letter-spacing: 3px; }
}

@media (max-width: 480px) {
  .grid, .grid-photo, .grid-card { grid-template-columns: repeat(1, minmax(0, 1fr)); }
}

/* 尊重系统的「减少动态效果」设置 */
@media (prefers-reduced-motion: reduce) {
  .site-title, #bg-layer { animation: none; }
  .item, .message, .panel.is-active { animation: none; }
}


/* ==========================================================================
   主题切换按钮（现在在顶栏里，登录按钮左边）
   ========================================================================== */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 13.5px;
  letter-spacing: 1.5px;
  color: var(--text);
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 999px;
  background-color: var(--bg-panel-solid);
  background-image: var(--rivets), linear-gradient(180deg, rgb(var(--c-panel-hi) / 0.9), rgb(var(--c-panel-lo) / 0.95));
  background-repeat: no-repeat;
  box-shadow: inset 0 1px 0 rgb(var(--c-hi) / 0.12), 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s, box-shadow 0.24s, border-color 0.2s, color 0.2s;
}
.theme-toggle:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  color: rgb(var(--c-brass-hi));
  box-shadow: inset 0 1px 0 rgb(var(--c-hi) / 0.18), 0 8px 22px rgba(0, 0, 0, 0.5), 0 0 20px rgb(var(--c-brass-hi) / 0.22);
}
.theme-toggle:active { transform: translateY(0); }

.theme-toggle .tt-ico {
  font-size: 15px;
  line-height: 1;
  color: rgb(var(--c-brass));
}
.theme-toggle .tt-swap { font-size: 12.5px; letter-spacing: 1px; color: var(--text-dim); }

@media (max-width: 900px) {
  .theme-toggle .tt-swap { display: none; }    /* 窄屏只留下当前配色，别把顶栏挤爆 */
}
@media (max-width: 620px) {
  .theme-toggle { padding: 6px 10px; font-size: 12.5px; gap: 5px; }
}

/* ==========================================================================
   科技蓝主题：在 <html> 上加 data-theme="tech" 即启用
   视觉语言：深空蓝底 / 冰蓝霓虹描边 / 玻璃面板 / 电路底纹 / 数据光点
   —— 只重定义色基三元组，其余全部继承（见文件顶部 :root 的说明）
   ========================================================================== */

[data-theme="tech"] {
  --c-brass: 53 200 255;         /* 主霓虹青 */
  --c-brass-hi: 155 231 255;     /* 亮青 */
  --c-brass-dark: 29 127 168;    /* 暗青 */
  --c-rivet: 190 245 255;        /* 指示灯 */
  --c-copper: 91 140 255;        /* 蓝紫 */
  --c-copper-hi: 169 196 255;
  --c-copper-dark: 43 74 158;
  --c-bronze: 47 74 107;
  --c-ember: 77 226 255;         /* 数据光 */
  --c-verdigris: 34 211 166;     /* 青绿 */
  --c-panel-hi: 26 44 70;        /* 面板亮部 */
  --c-panel: 18 32 52;
  --c-panel-lo: 12 23 38;
  --c-ink: 7 14 26;              /* 深空底 */
  --c-hi: 175 225 255;           /* 高光 */
  --c-text: 220 239 255;         /* 正文 */
  --c-text-dim: 143 176 204;
  --on-brass: #031018;           /* 霓虹青板上的深色字 */
  --title-face: linear-gradient(180deg, #eafaff 0%, #7fe0ff 45%, #2ea8e0 100%);   /* 霓虹灯管底色 */
}

/* 深空底 + 电路走线 + 扫描线 + 三团冷色光晕（替换蒸汽朋克的齿轮底纹） */
[data-theme="tech"] body {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cg fill='none' stroke='rgb(53,200,255)' stroke-opacity='0.10' stroke-width='1'%3E%3Cpath d='M0 42h46v-26h28'/%3E%3Cpath d='M160 98h-38v34'/%3E%3Cpath d='M66 160v-28h46'/%3E%3Cpath d='M100 0v20'/%3E%3C/g%3E%3Cg fill='rgb(155,231,255)' fill-opacity='0.20'%3E%3Ccircle cx='46' cy='42' r='2.4'/%3E%3Ccircle cx='122' cy='98' r='2.4'/%3E%3Ccircle cx='66' cy='132' r='2'/%3E%3Ccircle cx='100' cy='20' r='2'/%3E%3C/g%3E%3C/svg%3E") repeat,
    repeating-linear-gradient(0deg, rgb(var(--c-brass) / 0.030) 0 1px, transparent 1px 3px),
    radial-gradient(1100px 620px at 84% -8%, rgb(var(--c-brass) / 0.16), transparent 62%),
    radial-gradient(900px 560px at 4% 10%, rgb(var(--c-copper) / 0.15), transparent 62%),
    radial-gradient(760px 520px at 46% 112%, rgb(var(--c-verdigris) / 0.11), transparent 62%),
    var(--bg-deep);
  background-size: 160px 160px, auto, auto, auto, auto, auto;
  background-attachment: fixed;
}

/* 选区与滚动条换冷色 */
[data-theme="tech"] ::selection { background: rgb(var(--c-brass) / 0.40); color: #eafaff; }
[data-theme="tech"] ::-webkit-scrollbar-track { background: rgba(6, 12, 22, 0.85); }
[data-theme="tech"] ::-webkit-scrollbar-thumb { background: linear-gradient(180deg, rgb(var(--c-brass) / 0.6), rgb(var(--c-brass-dark) / 0.7)); }
[data-theme="tech"] ::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, rgb(var(--c-brass-hi) / 0.85), rgb(var(--c-brass) / 0.85)); }
[data-theme="tech"] ::-webkit-scrollbar-thumb,
[data-theme="tech"] ::-webkit-scrollbar-thumb:hover { background-clip: padding-box; }

/* 自定义背景图的压暗层：冷色 */
[data-theme="tech"] body.has-bg::after { background: rgba(4, 10, 20, var(--veil)); }

/* 标题：黄铜灯 → 霓虹灯管（底色换成冷色，寒光扫过照旧）
   日文副标题是朴素文字，用主题变量着色，不用单独覆盖 */
[data-theme="tech"] .site-title {
  animation: titleShine 5.2s ease-in-out infinite, techPulse 3.6s ease-in-out infinite;
}
@keyframes techPulse {
  0%, 100% { filter: drop-shadow(0 0 10px rgb(var(--c-brass) / 0.35)); }
  50% { filter: drop-shadow(0 0 22px rgb(var(--c-brass) / 0.65)); }
}

/* 提示条进度条换青色（成功/失败保留语义色） */
[data-theme="tech"] .toast-bar { background: linear-gradient(90deg, rgb(var(--c-brass-dark)), rgb(var(--c-brass-hi))); }

/* 危险按钮在冷色底上再压一点蓝，避免过暖 */
[data-theme="tech"] .btn.danger { background: linear-gradient(180deg, #ff7a72, #b02f3c 55%, #7d1c2a); }

/* ==================== 手机端（≤640px）总适配 ==================== */

@media (max-width: 640px) {
  /* 聊天面板铺满全屏：手机上「居中的悬浮窗 + 90vh」既浪费高度，
     又会在键盘弹出时把输入框顶到屏幕外 */
  .chat-panel {
    left: 0;
    top: 0;
    width: 100%;
    height: 100vh;                                 /* 老浏览器兜底 */
    height: 100dvh;                                /* 动态视口高度：跟着地址栏 / 键盘变 */
    max-height: none;
    border: none;
    border-radius: 0;
    transform: none;
    opacity: 1;
    transition: opacity 0.2s ease;                 /* 手机上不做位移缩放，避免抖动 */
  }
  .chat-panel.is-open { transform: none; }
  .chat-backdrop { backdrop-filter: none; }        /* 手机上毛玻璃很费性能，关掉 */

  .chat-body { padding: 12px 10px 8px; gap: 10px; }
  .chat-bubble { max-width: 84%; font-size: 15px; }
  .chat-bubble.is-img img { max-width: 58vw; max-height: 58vw; }
  .chat-head { padding: 10px 12px; }
  .chat-close { width: 36px; height: 36px; }       /* 触摸目标放大一点 */

  /* 输入区：贴底 + 避开 iPhone 底部横条 */
  .chat-input {
    padding: 8px 10px calc(9px + env(safe-area-inset-bottom, 0px));
  }
  /* ★ 关键：输入框字号必须 ≥16px，否则 iOS Safari 聚焦时会自动放大整个页面 */
  .chat-input input { font-size: 16px; padding: 11px 14px; }
  .chat-send { padding: 10px 16px; font-size: 14px; }
  .chat-img-btn { width: 38px; height: 38px; }

  /* 全站其它输入框同理，统一防 iOS 放大 */
  .search-box input { width: 100%; font-size: 16px; }
  .role-input { font-size: 16px; min-height: 132px; }
  .form-row input, .form-row textarea { font-size: 16px; }
  .role-page { padding: 12px 12px calc(14px + env(safe-area-inset-bottom, 0px)); }

  /* 照片 / 角色卡：手机上 2 列比 1 列好用得多（19 张排一列要一直滚） */
  .grid, .grid-photo, .grid-card { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-story { grid-template-columns: 1fr; }

  /* 悬浮聊天按钮避开底部横条 */
  .chat-fab { bottom: calc(16px + var(--legal-h) + env(safe-area-inset-bottom, 0px)); }

  /* 标签栏与工具栏：触摸目标别太小 */
  .tab { padding: 9px 10px; }
  .toolbar .btn { padding: 10px 14px; }
}

/* ==================== 底部备案信息条 ==================== */
/* 固定在最下方，黑底白字居中；z-index 低于聊天面板(83)与弹窗(90)，
   所以打开弹窗 / 聊天时它会被正常盖住，不会浮在上面碍事 */
.legal-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  height: var(--legal-h);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  /* iPhone 底部手势横条：额外加一层安全区，文字不会被挡住 */
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-sizing: content-box;
}
.legal-bar a {
  color: #fff;
  font-size: 12.5px;
  line-height: 1;
  letter-spacing: 0.5px;
  text-decoration: none;
  white-space: nowrap;
}
.legal-bar a:hover { text-decoration: underline; }

/* 页面内容底部留出备案条的高度，免得最后一行被它盖住 */
.app {
  padding-bottom: calc(22px + var(--legal-h) + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 380px) {
  /* 超窄屏（iPhone SE 一代那种）：字号与内边距再收一点 */
  .chat-bubble { max-width: 88%; font-size: 14.5px; }
  .chat-input input { font-size: 16px; padding: 10px 12px; }
  .chat-send { padding: 10px 13px; }
  .brand { letter-spacing: 1px; }
}

/* ==================== 输入框违禁词标红 ==================== */
/* 边输入边检查：命中违禁词就把边框变红并加一点红光，鼠标悬停能看到是哪个词。
   真正的拦截在服务端（保存时会返回 400 + 明确提示），这里只是即时提醒。 */
input.has-banned,
textarea.has-banned,
.form-row input.has-banned,
.form-row textarea.has-banned,
.role-input.has-banned,
.chat-input input.has-banned {
  border-color: rgb(217 83 79) !important;
  box-shadow: 0 0 0 3px rgb(217 83 79 / 0.20), inset 0 2px 7px rgba(0, 0, 0, 0.45) !important;
  background: rgb(217 83 79 / 0.08) !important;
  animation: bannedShake 0.32s ease;
}
@keyframes bannedShake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-3px); }
  75%      { transform: translateX(3px); }
}
@media (prefers-reduced-motion: reduce) {
  input.has-banned, textarea.has-banned { animation: none; }
}

/* ==================== 违禁提示弹框 ==================== */
.modal-box.is-filter { width: min(460px, 94vw); }

.filter-title { margin: 0 0 6px; text-align: center; }
.filter-title.is-ban { color: #ffb3ad; }

.filter-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 6px 0 18px;
  padding: 16px 14px;
  border: 1px solid rgb(217 83 79 / 0.45);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgb(217 83 79 / 0.10), rgb(var(--c-ink) / 0.6));
}
.filter-img {
  display: block;
  width: 100%;
  max-width: 300px;
  max-height: 38vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
  background: #000;
}
.filter-text {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.85;
  text-align: center;
  color: var(--text);
}
.filter-text b { color: #ffb3ad; }
.filter-warn {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 10px 14px;
  font-size: 13.5px;
  line-height: 1.85;
  text-align: center;
  color: #ffe2dd;
  border: 1px solid rgb(217 83 79 / 0.55);
  border-radius: var(--radius-sm);
  background: rgb(217 83 79 / 0.16);
}
.filter-warn b { color: #fff; }
.filter-sub { margin: 0; font-size: 13px; line-height: 1.8; text-align: center; color: var(--text-dim); }

/* ==================== 主页面隐藏整页滚动条 ==================== */
/* 只隐藏「整页」这一根：内容照常可以滚 —— 滚轮、触屏滑动、键盘（↑↓ / PgUp / PgDn / 空格）、
   手机上都没问题，只是不再画出那根条子。
   站内其它自己滚动的区域（聊天消息、聊天角色栏、角色页、卡片详情图、
   卡片信息栏、弹窗内容、账号管理列表）滚动条保持可见 ——
   否则用户会看不出那些区域还能往下滚。 */
html, body {
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* 旧版 Edge / IE */
}
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;                  /* Chrome / Safari / 新版 Edge */
}

/* ==================== 角色卡详情：图片框统一高度 ==================== */
/* 原来图片框的高度是跟着图片本身高矮变的：竖图占满，横图/短图就矮一截，
   轮播时整个左栏会忽高忽低。现在改成：
     · 框子高度固定撑满弹窗（等于最高那张图占的高度）→ 每张卡看起来一样高
     · 短图垂直居中，上下用纯黑填充（照片框那种留边效果）
     · 比框还高的长图：仍然在框内上下滚动，不会被压扁，也不会被裁掉顶部 */
.card-detail-media {
  align-self: stretch;      /* 撑满弹窗内容高度，不再随图片高矮变化 */
  max-height: none;
  background: #000;         /* 短图上下填充纯黑 */
}
.card-detail-scroll {
  display: flex;
  flex-direction: column;
}
/* 垂直居中用「自动外边距」而不是 justify-content:center ——
   后者在图比框高时会把顶部裁掉、滚不到；自动外边距会自己变回从顶部开始 */
.card-detail-scroll img {
  margin: auto 0;
  object-fit: contain;
}

@media (max-width: 700px) {
  /* 手机上改成上下堆叠，图片框固定高度：每张卡都一样高 */
  .card-detail-media {
    height: 42vh;
    max-height: 42vh;
  }
}

@media (max-width: 420px) {
  .card-detail-media {
    height: 36vh;
    max-height: 36vh;
  }
}
