@import url("https://fonts.loli.net/css2?family=Noto+Serif+SC:wght@400;600;700&display=swap");

/* ============================================================
   夜叉论坛插件样式 · 赭红暖纸风
   视觉系统完全采用静态稿（论坛前台效果/forum.html）：
   中性暖纸底 + 奶油卡片 + 扁平无阴影 + 8px 圆角 + Noto Serif SC
   浅色模式作用域覆盖主题令牌；暗色模式回退主题暗色令牌
   ============================================================ */

/* ---------- 静态稿设计令牌（仅论坛页，浅色模式） ---------- */
html:not([data-theme="dark"]) .bbs {
  --bg:           #F7F2EA;
  --bg-soft:      #F3EDE2;
  --card:         #FFFCF7;
  --card-hover:   #F3EDE2;
  --border:       #E7DECF;
  --border-strong:#D8CCB4;
  --hairline:     #E7DECF;
  --ink:          #2E2A25;
  --text:         #2E2A25;
  --text-soft:    #6E655A;
  --text-faint:   #9C9284;
  --accent:       #A8492B;
  --accent-deep:  #8A3B20;
  --accent-soft:  #E9D5C8;
  --accent-faint: #F6E8DB;
  --accent-glow:  rgba(168, 73, 43, 0.12);
  --shadow-sm:    none;
  --shadow-md:    0 2px 8px rgba(46, 42, 37, 0.06);
  --shadow-lg:    0 2px 8px rgba(46, 42, 37, 0.06);
  --radius-sm:    6px;
  --radius-md:    8px;
  --radius-lg:    8px;
}

/* 论坛页整页底色（浅色模式） */
html:not([data-theme="dark"]) body:has(.bbs) { background: #F7F2EA; }

/* ---------- 暖色轮换头像（静态稿 av1-av8） ---------- */
.f-avatar.av1{background:#E9D5C8;color:#8A3B20}
.f-avatar.av2{background:#E7DCC4;color:#7A5A22}
.f-avatar.av3{background:#E2D2C9;color:#7C4034}
.f-avatar.av4{background:#E5D8CE;color:#6E4A2E}
.f-avatar.av5{background:#EADFCB;color:#6B6130}
.f-avatar.av6{background:#E0D6C2;color:#5F5A3A}
.f-avatar.av7{background:#EBD3C5;color:#93502F}
.f-avatar.av8{background:#E4D9CB;color:#6E5A3E}

/* ---------- 骨架 ---------- */
.bbs { padding-top: 26px; padding-bottom: 70px; }
.bbs .layout { padding-bottom: 0; }
.bbs .layout > main, .bbs .layout > aside { min-width: 0; }
.bbs .dot { margin: 0 7px; color: var(--text-faint); }
.bbs-crumbs { font-size: 13px; color: var(--text-faint); margin-bottom: 14px; }
.bbs-crumbs a { color: var(--text-faint); text-decoration: none; }
.bbs-crumbs a:hover { color: var(--accent-deep); }

/* ---------- 板块入口条 ---------- */
.bbs-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 20px; }
.bbs-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 15px; border-radius: 999px; border: 1px solid var(--hairline);
  background: var(--card); color: var(--text-soft);
  font-size: 13px; text-decoration: none; transition: all .18s ease;
}
.chip-ico { width: 15px; height: 15px; flex: none; }
.bbs-chip:hover { color: var(--accent-deep); border-color: var(--accent); }
.bbs-chip.is-active { background: var(--accent); color: #FAF7EE; border-color: var(--accent); font-weight: 600; }
.bbs-chip.is-active:hover { color: #FAF7EE; }
.bbs-new { margin-left: auto; padding: 6px 18px; font-size: 13.5px; }

/* ---------- 提示条 ---------- */
.bbs-flash {
  background: var(--card); border: 1px solid var(--hairline); border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg); padding: 11px 16px; font-size: 13.5px; color: var(--text-soft); margin-bottom: 16px;
}
.bbs-flash.is-err { border-left-color: #A93B32; color: #A93B32; }

/* ---------- 面板（列表容器） ---------- */
.f-panel {
  background: var(--card); border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden;
}

/* 面板头：最新主题 | 今日 N 帖 · RSS */
.f-panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--hairline);
}
.f-h2 { font-family: var(--font-serif); font-size: 17px; font-weight: 700; color: var(--ink); }
.f-h1 { font-family: var(--font-serif); font-size: 20px; font-weight: 600; color: var(--ink); line-height: 1.4; }
.f-sub { font-size: 12px; color: var(--text-faint); }
.f-rss { color: var(--text-faint); text-decoration: none; }
.f-rss:hover { color: var(--accent-deep); }

/* 板块头（板块页面板内）：图标徽章 + 名称 + 醒目描述 | 统计 */
.f-forum-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--hairline);
}
.f-board-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.f-board-ico {
  width: 46px; height: 46px; border-radius: 10px; flex: none;
  background: var(--accent); color: #FAF7EE;
  display: flex; align-items: center; justify-content: center;
}
.f-board-ico .ico { width: 22px; height: 22px; }
.f-board-desc { font-size: 14px; font-weight: 500; color: var(--accent-deep); margin-top: 4px; }
.f-board-stats { flex: none; font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.f-board-stats b { font-weight: 600; color: var(--text-soft); }

/* 侧栏卡片标题线性图标 */
.side-ico { display: inline-flex; align-items: center; color: var(--accent); flex: none; }
.side-ico .ico { width: 16px; height: 16px; }

/* 排序标签（面板内一行） */
.f-tabs { display: flex; gap: 4px; padding: 10px 20px; border-bottom: 1px solid var(--hairline); }
.f-tab {
  font-size: 13px; color: var(--text-soft); text-decoration: none;
  padding: 5px 12px; border-radius: 6px; transition: all .15s ease;
}
.f-tab:hover { color: var(--accent-deep); }
.f-tab.is-active { background: var(--accent-faint); color: var(--accent-deep); font-weight: 600; }

/* ---------- 帖子列表行：三行结构 + 右列三行 ---------- */
.f-row {
  display: flex; gap: 14px; padding: 16px 20px;
  border-bottom: 1px solid var(--hairline); text-decoration: none; position: relative;
}
.f-row:last-child { border-bottom: none; }
.f-row:hover { background: var(--card-hover); }
.f-row:hover .f-title { color: var(--accent-deep); }
.f-row.is-pinned { background: var(--accent-faint); }
.f-row.is-pinned:hover { background: var(--accent-faint); }
.f-row.is-pinned::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }

.f-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--accent-faint); color: var(--accent-deep);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-weight: 700; font-size: 16px;
}
.f-avatar-sm { width: 26px; height: 26px; font-size: 12px; }

.f-main { flex: 1; min-width: 0; }
.f-row1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.f-title {
  font-family: var(--font-serif); font-size: 15px; font-weight: 600;
  color: var(--ink); line-height: 1.5; transition: color .15s ease;
}
.f-meta { display: flex; align-items: center; margin-top: 6px; font-size: 12px; color: var(--text-faint); }

/* 列表行固定两行：标题单行省略、徽章不换行（通知行除外，保持可换行） */
.f-row:not(.notice-row) .f-row1 { flex-wrap: nowrap; }
.f-row:not(.notice-row) .f-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.f-row .f-badge { flex: none; }

/* 列表行内可点的用户名（行本身是链接，用 preventDefault 避免触发跳帖） */
.f-un { cursor: pointer; }
.f-un:hover { color: var(--accent-deep); text-decoration: underline; }

.f-stats { flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.f-stats .f-stat-line { display: block; font-size: 12px; color: var(--text-faint); margin-top: 3px; }
.f-stats .f-stat-line:first-child { margin-top: 0; }
.f-stats .f-stat-line b { font-size: 13px; color: var(--accent-deep); font-weight: 600; }

.f-badge { flex: none; font-size: 11px; line-height: 1.7; padding: 1px 7px; border-radius: 4px; }
.f-badge-pin { background: var(--accent); color: #FAF7EE; }
.f-badge-ess { color: var(--accent-deep); border: 1px solid var(--accent); padding: 0 6px; }
.f-badge-lock { color: var(--text-faint); border: 1px solid var(--hairline); padding: 0 6px; }

.f-empty { padding: 34px 20px; text-align: center; font-size: 13.5px; color: var(--text-faint); }

/* 搜索条 */
.f-search { display: flex; gap: 10px; padding: 14px 18px; }
.f-search .f-grow { flex: 1; }

/* 分页（面板内） */
.f-pager { padding: 18px 20px 10px; }
.f-pager nav { display: flex; justify-content: center; }

/* 消息中心操作行（参考样式：圆角赭红按钮组） */
.f-actions { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--hairline); }
.f-actions .btn-rust { padding: 7px 16px; font-size: 13px; }
.f-actions form { display: inline; }

/* ---------- 帖子详情 ---------- */
.f-thread-head { margin: 6px 0 22px; padding-bottom: 18px; border-bottom: 1px solid var(--hairline); }
.f-thread-head .f-row1 { align-items: baseline; }
.f-thread-head .f-h1 { display: inline; }
.f-thread-meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--text-faint); }
.f-thread-meta b { color: var(--text-soft); }
.f-thread-ops { margin-left: auto; display: inline-flex; gap: 12px; align-items: center; }

.f-op { font-size: 12.5px; color: var(--text-faint); text-decoration: none; background: none; border: none; cursor: pointer; padding: 0; font-family: inherit; }
.f-op:hover { color: var(--accent-deep); }
.f-op.is-danger:hover { color: #A93B32; }
.f-op-form { display: inline; }
.f-pin-select {
  height: 28px; padding: 0 26px 0 10px;
  border: 1px solid var(--hairline); border-radius: 6px;
  background: var(--card) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239C9284' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 10px;
  color: var(--ink); font-size: 12.5px; font-family: inherit;
  cursor: pointer; appearance: none; -webkit-appearance: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.f-pin-select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.floor { display: flex; gap: 14px; background: var(--card); border: 1px solid var(--hairline); border-radius: var(--radius-lg); padding: 18px 22px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.floor-head { display: flex; align-items: baseline; gap: 9px; font-size: 13px; color: var(--text-faint); }
.floor-head b { font-size: 13.5px; color: var(--text-soft); }
.floor-head b a, .f-thread-author { color: inherit; text-decoration: none; }
.floor-head b a:hover, .f-thread-author:hover b, .f-thread-author:hover { color: var(--accent-deep); }
.f-thread-author { display: inline-flex; align-items: center; gap: 8px; }
.bbs-user-cell { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; text-decoration: none; color: inherit; }
.bbs-user-cell:hover .bbs-user-name { color: var(--accent-deep); }
.f-admin { font-size: 11px; color: var(--accent-deep); border: 1px solid var(--accent); border-radius: 4px; padding: 0 5px; }
.floor-time { margin-left: auto; }
.floor-no { font-variant-numeric: tabular-nums; color: var(--text-faint); }
.floor-content { margin-top: 10px; font-size: 15.5px; line-height: 1.9; color: var(--ink); overflow-wrap: break-word; }
.floor-content p { margin: 0 0 12px; }
.floor-content p:last-child { margin-bottom: 0; }
.floor-content img { max-width: 100%; border-radius: 8px; }
.floor-content pre { background: var(--accent-faint); border: 1px solid var(--hairline); border-radius: 8px; padding: 12px 16px; overflow-x: auto; font-size: 13px; }
.floor-content code { font-size: 13px; }
.floor-content blockquote { border-left: 3px solid var(--accent); background: var(--accent-faint); margin: 0 0 12px; padding: 8px 14px; color: var(--text-soft); font-size: 14px; }

.floor-acts { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.f-like {
  background: none; border: 1px solid var(--hairline); border-radius: 999px;
  padding: 3px 12px; font-size: 12.5px; color: var(--text-faint); cursor: pointer;
  font-family: inherit; transition: all .15s ease;
}
.f-like:hover { color: var(--accent-deep); border-color: var(--accent); }
.f-like.is-liked { background: var(--accent); border-color: var(--accent); color: #FAF7EE; }

/* ---------- 回复区 ---------- */
.f-reply { margin-top: 26px; }
.f-reply-box { display: flex; gap: 12px; align-items: flex-start; }
.f-reply-box .f-avatar { margin-top: 4px; }
.f-input {
  width: 100%; background: var(--card); border: 1px solid var(--hairline);
  border-radius: 10px; padding: 10px 14px; font-size: 14px; color: var(--ink);
  font-family: inherit; outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.f-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
textarea.f-input { resize: vertical; }
.f-reply-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 12px; }
.f-reply-login {
  display: flex; align-items: center; gap: 16px; justify-content: center;
  background: var(--card); border: 1px solid var(--hairline); border-radius: var(--radius-lg);
  padding: 22px; font-size: 14px; color: var(--text-soft);
}
.f-reply-login .btn-rust { padding: 8px 22px; }

/* ---------- 表单页 / 管理页 ---------- */
.f-form { padding: 24px 26px; }
.f-field { margin-bottom: 18px; }
.f-field label { display: block; font-size: 13px; color: var(--text-soft); font-weight: 600; margin-bottom: 7px; }
.f-static { font-size: 14px; color: var(--ink); padding: 8px 0; }
.f-md { font-family: ui-monospace, Consolas, monospace; font-size: 13.5px; line-height: 1.8; }
.f-form .btn-rust { padding: 9px 26px; }

.f-admin-row { display: flex; gap: 10px; align-items: center; padding: 14px 18px; margin-bottom: 10px; flex-wrap: wrap; }
.f-admin-row .f-input { width: auto; }
.f-admin-row .f-grow { flex: 1; min-width: 180px; }
.f-admin-row .f-xs { width: 72px; }
.f-admin-meta { font-size: 12.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.f-admin-del { text-align: right; margin: -6px 0 14px; }

/* ---------- 侧栏：热门主题 / 活跃会员 / 友链（静态稿样式） ---------- */
.f-hot-list { display: flex; flex-direction: column; }
.f-hot { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; text-decoration: none; }
.f-hot-no {
  flex: none; min-width: 20px;
  font-family: var(--font-serif); font-size: 13px; font-weight: 600;
  color: var(--accent); font-variant-numeric: tabular-nums;
}
.f-hot-title {
  flex: 1; min-width: 0;
  font-size: 13.5px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .15s ease;
}
.f-hot:hover .f-hot-title { color: var(--accent-deep); }

.bbs-wall { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px 8px; }
.bbs-user-cell { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.bbs-wall .f-avatar-sm { width: 32px; height: 32px; font-size: 13px; }
.bbs-user-name {
  max-width: 100%; font-size: 11px; color: var(--text-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.bbs-links { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.bbs-links a { font-size: 13px; color: var(--text-soft); text-decoration: none; }
.bbs-links a:hover { color: var(--accent-deep); }

/* ---------- 论坛态页头（nav.replace 注入：logo 之后的搜索+动作区） ---------- */
/* 搜索框靠右：logo 居左，搜索与动作区一起排右侧 */
.bbs-navsearch { flex: 0 1 340px; margin-left: auto; position: relative; }
.bbs-navsearch input {
  width: 100%; height: 34px; border: none; border-radius: 6px;
  background: var(--bg-soft); padding: 0 58px 0 30px;
  font-size: 13px; color: var(--ink); font-family: inherit; outline: none;
  transition: background .15s ease, box-shadow .15s ease;
}
.bbs-navsearch input::placeholder { color: var(--text-faint); }
.bbs-navsearch input:focus {
  background: var(--card);
  box-shadow: 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-glow);
}
.bbs-search-ico {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--text-faint); pointer-events: none;
}
.bbs-scope {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  height: 24px; padding: 0 10px; border: 1px solid var(--hairline); border-radius: 999px;
  background: var(--card); color: var(--text-faint);
  font-size: 11.5px; cursor: pointer; font-family: inherit; transition: all .15s ease;
}
.bbs-scope:hover { color: var(--accent-deep); border-color: var(--accent); }
.bbs-scope.is-site { background: var(--accent-faint); color: var(--accent-deep); border-color: var(--accent); }

.bbs-navacts { margin-left: 0; display: flex; align-items: center; gap: 16px; }
.bbs-postbtn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 18px; border-radius: 6px;
  background: var(--accent); color: #FAF7EE;
  font-size: 13.5px; text-decoration: none; transition: background .15s ease;
}
.bbs-postbtn:hover { background: var(--accent-deep); color: #FAF7EE; }
.bbs-nav-act { font-size: 14px; color: var(--text-soft); text-decoration: none; }
.bbs-nav-act:hover { color: var(--accent-deep); }
.bbs-nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 5px; margin-left: 3px;
  border-radius: 999px; background: var(--accent); color: #FAF7EE;
  font-size: 10.5px; font-variant-numeric: tabular-nums; vertical-align: 1px;
}

/* ---------- 私信 ---------- */
.msg-thread { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; max-height: 60vh; overflow-y: auto; }
.msg-line { display: flex; gap: 10px; align-items: flex-start; }
.msg-line.is-mine { flex-direction: row-reverse; }
.msg-bubble {
  max-width: 72%; background: var(--bg-soft); border: 1px solid var(--hairline);
  border-radius: 10px; padding: 9px 13px;
}
.msg-line.is-mine .msg-bubble { background: var(--accent-faint); border-color: var(--accent-soft); }
.msg-text { font-size: 14px; color: var(--ink); line-height: 1.7; white-space: pre-wrap; overflow-wrap: break-word; }
.msg-time { margin-top: 4px; font-size: 11px; color: var(--text-faint); text-align: right; }

.f-msg-form { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--hairline); align-items: flex-end; }
.f-msg-form .f-input { flex: 1; }
.f-msg-form .btn-rust { height: 38px; padding: 0 22px; }

@media (max-width: 640px) {
  .bbs-navsearch { max-width: none; margin-left: 4px; }
  .bbs-navsearch input { padding-right: 52px; }
  .bbs-navacts { gap: 10px; }
  .bbs-postbtn { padding: 0 12px; }
}

/* ---------- 论坛个人中心 ---------- */
.f-me-head { display: flex; align-items: center; gap: 16px; padding: 22px 24px; margin-bottom: 14px; }
.f-me-avatar { width: 64px; height: 64px; font-size: 26px; border-radius: 16px; }
.f-me-id { flex: 1; min-width: 0; }
.f-me-id .f-h1 { display: flex; align-items: center; gap: 8px; }
.f-me-bio { font-size: 13.5px; color: var(--text-soft); margin-top: 4px; }
.f-me-sub { font-size: 12px; color: var(--text-faint); margin-top: 6px; }
.f-me-head .site-stats { flex: none; grid-template-columns: repeat(4, auto); gap: 0 18px; }
.f-me-head .site-stats > div { min-width: 62px; }
.f-me-logout { flex: none; }
.f-me-tabs { background: var(--card); border: 1px solid var(--hairline); border-radius: var(--radius-lg); padding: 8px 10px; margin-bottom: 14px; }
.notice-row { cursor: default; }
.notice-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: 2px; }
.f-notice-text { font-family: var(--sans); font-size: 13.5px; font-weight: 400; }
.f-notice-text a { color: var(--accent-deep); }
.f-post-row { display: block; padding: 12px 20px; border-bottom: 1px solid var(--hairline); text-decoration: none; }
.f-post-row:hover { background: var(--card-hover); }
.f-post-snippet { display: block; font-size: 14px; color: var(--ink); line-height: 1.6; }
.f-post-row:hover .f-post-snippet { color: var(--accent-deep); }
.f-post-meta { display: block; margin-top: 3px; font-size: 12px; color: var(--text-faint); }

/* ---------- Cherry 编辑器 ---------- */
[data-forum-editor] { border-radius: 8px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .bbs .layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .f-row { padding: 14px 14px; gap: 10px; }
  .f-stats .f-stat-line:nth-child(2) { display: none; }
  .f-panel-head, .f-forum-head, .f-tabs { padding-left: 14px; padding-right: 14px; }
  .f-forum-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .floor { padding: 14px; }
  .bbs-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .bbs-chips::-webkit-scrollbar { display: none; }
  .bbs-new { margin-left: 0; flex: none; }
}
