/* WTLiker 全站基础样式。设计方案见 DESIGN.md 第 5 节。
   模块样式各自一个文件（forum.css / member.css / resource.css / community.css），只用这里的变量和组件，不改这里。 */

:root {
  /* 配色 */
  --gunmetal: #2a323b;      /* 导航条、页脚 */
  --gunmetal-2: #343e49;    /* 导航悬停 */
  --night: #142636;         /* 横幅底色、压暗层 */
  --hangar: #e4e7ea;        /* 页面底色 */
  --steel: #3d566e;         /* 内容块标题条 */
  --steel-2: #4c6a86;
  --roundel: #1f6fb2;       /* 链接、主按钮 */
  --roundel-dark: #185a91;
  --taxiway: #f2b632;       /* 极少量：当前导航、未读、置顶 */
  --surface: #ffffff;
  --surface-2: #f4f6f8;     /* 次级底色（表头、引用块、偶数行） */
  --line: #cfd5db;          /* 1px 描边 */
  --line-2: #e3e7eb;        /* 内部分隔线 */
  --ink: #1d2630;           /* 正文 */
  --ink-2: #4a5866;         /* 次要文字 */
  --ink-3: #7a8794;         /* 弱化文字（时间、统计） */
  --ok: #2e7d4f;
  --warn: #b26a00;
  --danger: #b3261e;

  /* 字体 */
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-xs: 12px; --fs-s: 13px; --fs: 15px; --fs-m: 18px; --fs-l: 22px; --fs-xl: 26px;
  --lh: 1.65;

  /* 尺寸 */
  --wrap: 1240px;
  --side: 300px;
  --gap: 16px;
  --r-block: 4px; --r-btn: 3px; --r-tag: 2px;
  --nav-h: 44px;
  --focus: 0 0 0 3px rgba(31, 111, 178, .45);
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--hangar); color: var(--ink);
  font: var(--fs)/var(--lh) var(--font);
  font-variant-numeric: tabular-nums;
}
a { color: var(--roundel); text-decoration: none; }
a:hover { color: var(--roundel-dark); text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 600; }
p { margin: 0 0 .8em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-btn); }
.skip { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--surface); padding: 8px 12px; }
.skip:focus { left: 8px; top: 8px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 横幅 ---------- */
/* 唯一的视觉重点：一张站内精选涂装截图（--banner），夜航色压暗，左 logo 右搜索，右下角署名。 */
.masthead {
  /* 11-27 用户嫌图放得太大：宽屏不再铺满（800 宽的中图要放大到 2.5 倍、只露 14% 的高度），
     改成按原大小靠右放（最宽 800px、不超过页头六成），左边夜航色实底、渐变过渡到图上 */
  --banner-w: min(800px, 60%);
  position: relative; background-color: var(--night); color: #fff; min-height: 160px;
  background-image:
    linear-gradient(90deg, var(--night) 0%, var(--night) calc(100% - var(--banner-w)),
      rgba(20, 38, 54, .6) calc(100% - var(--banner-w) + 200px), rgba(20, 38, 54, .25) 100%),
    var(--banner, none);
  background-size: 100% 100%, var(--banner-w) auto;
  background-position: 0 0, 100% 40%;
  background-repeat: no-repeat;
  display: flex; align-items: center;
}
@media (max-width: 800px) {
  /* 窄屏页头本来就窄，铺满时放大得不多，照旧铺满 */
  .masthead {
    background-image:
      linear-gradient(90deg, rgba(20, 38, 54, .92) 0%, rgba(20, 38, 54, .55) 45%, rgba(20, 38, 54, .25) 100%),
      var(--banner, none);
    background-size: cover; background-position: center 40%;
  }
}
.masthead:not(.has-banner) {
  background-size: cover; background-repeat: repeat;
  /* 没有精选图时：机身蒙皮的铆钉线 */
  background-image:
    linear-gradient(90deg, rgba(20, 38, 54, 1) 0%, rgba(20, 38, 54, .7) 100%),
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(255, 255, 255, .06) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 119px, rgba(255, 255, 255, .05) 119px 120px);
}
.masthead-inner { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-top: 20px; padding-bottom: 28px; }
.brand { display: flex; align-items: flex-end; gap: 14px; color: #fff; }
.brand:hover { text-decoration: none; color: #fff; }
.brand-mark { display: block; width: 188px; height: auto; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .45)); }
.brand-tag { font-size: var(--fs); letter-spacing: .08em; color: rgba(255, 255, 255, .82); padding-bottom: 6px; }
.masthead-search { display: flex; width: min(340px, 40vw); }
.masthead-search input {
  flex: 1; min-width: 0; height: 36px; padding: 0 12px; border: 1px solid rgba(255, 255, 255, .28); border-right: 0;
  background: rgba(10, 20, 30, .55); color: #fff; border-radius: var(--r-btn) 0 0 var(--r-btn);
}
.masthead-search input::placeholder { color: rgba(255, 255, 255, .6); }
.masthead-search button {
  height: 36px; padding: 0 14px; border: 1px solid rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .12); color: #fff;
  border-radius: 0 var(--r-btn) var(--r-btn) 0; cursor: pointer;
}
.masthead-search button:hover { background: rgba(255, 255, 255, .22); }
.banner-credit {
  position: absolute; right: 16px; bottom: 8px; font-size: var(--fs-xs); color: rgba(255, 255, 255, .78);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6); max-width: 60%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.banner-credit span { margin-left: .8em; }
.banner-credit:hover { color: #fff; }

/* ---------- 导航条 ---------- */
.navbar { background: var(--gunmetal); color: #dfe5ea; position: sticky; top: 0; z-index: 20; }
.navbar-inner { display: flex; align-items: stretch; min-height: var(--nav-h); }
.navlist { display: flex; list-style: none; margin: 0; padding: 0; flex: 1; }
.navlist a {
  display: flex; align-items: center; height: 100%; padding: 0 16px; color: #dfe5ea; font-size: var(--fs);
  border-bottom: 3px solid transparent; border-top: 3px solid transparent;
}
.navlist a:hover { background: var(--gunmetal-2); color: #fff; text-decoration: none; }
.navlist a[aria-current="page"] { color: #fff; border-bottom-color: var(--taxiway); background: var(--gunmetal-2); }
.nav-toggle { display: none; }
.navbar-user { display: flex; align-items: center; gap: 4px; }
.navbar-link { color: #dfe5ea; padding: 0 12px; line-height: var(--nav-h); }
.navbar-link:hover { color: #fff; text-decoration: none; background: var(--gunmetal-2); }
.navbar-reg { color: #fff; font-weight: 600; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 0 10px; height: var(--nav-h); cursor: pointer; color: #fff; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover { background: var(--gunmetal-2); }
.usermenu-pop {
  position: absolute; right: 0; top: 100%; min-width: 180px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-block); box-shadow: 0 8px 24px rgba(20, 38, 54, .22); padding: 6px 0; z-index: 30;
}
.usermenu-pop a, .usermenu-pop button {
  display: block; width: 100%; text-align: left; padding: 8px 16px; color: var(--ink); background: none; border: 0; cursor: pointer; font-size: var(--fs);
}
.usermenu-pop a:hover, .usermenu-pop button:hover { background: var(--surface-2); text-decoration: none; }
.usermenu-pop form { margin: 0; border-top: 1px solid var(--line-2); margin-top: 4px; padding-top: 4px; }

/* ---------- 页面框架 ---------- */
.page { padding-top: 14px; padding-bottom: 32px; }
.page-head { margin-bottom: 12px; }
.crumbs { font-size: var(--fs-s); color: var(--ink-3); margin-bottom: 6px; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.crumbs a { color: var(--ink-2); }
.crumbs-sep { color: var(--ink-3); }
.page-title { font-size: var(--fs-l); font-weight: 600; color: var(--ink); }
.page-desc { color: var(--ink-2); font-size: var(--fs-s); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.layout { display: block; }
.layout.has-side { display: grid; grid-template-columns: minmax(0, 1fr) var(--side); gap: var(--gap); align-items: start; }
.main { min-width: 0; }
.side { display: flex; flex-direction: column; gap: var(--gap); }

/* ---------- 内容块（XenForo 式：钢蓝标题条 + 白底 + 1px 描边） ---------- */
.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-block); margin-bottom: var(--gap); overflow: hidden; }
.block-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--steel); color: #fff; padding: 9px 14px; font-size: var(--fs); font-weight: 600;
}
.block-head h2, .block-head h3 { font-size: var(--fs); font-weight: 600; }
.block-head a { color: #fff; }
.block-head .block-head-aside { font-weight: 400; font-size: var(--fs-s); color: rgba(255, 255, 255, .8); }
.block-sub { background: var(--surface-2); border-bottom: 1px solid var(--line-2); padding: 6px 14px; font-size: var(--fs-s); color: var(--ink-2); }
.block-body { padding: 14px; }
.block-body > :last-child { margin-bottom: 0; }
.block-foot { border-top: 1px solid var(--line-2); padding: 8px 14px; font-size: var(--fs-s); color: var(--ink-2); background: var(--surface-2); }
/* 侧栏小块：标题条更轻 */
.side .block-head { background: var(--surface-2); color: var(--ink); border-bottom: 1px solid var(--line); padding: 8px 12px; }
.side .block-head a { color: var(--ink); }
.side .block-body { padding: 10px 12px; font-size: var(--fs-s); }

/* 行列表（主题列表、最新帖子、会员列表通用） */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line-2); }
.row:first-child { border-top: 0; }
.row:hover { background: #fafbfc; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: var(--fs); font-weight: 500; color: var(--ink); display: block; overflow: hidden; text-overflow: ellipsis; }
.row-meta { font-size: var(--fs-s); color: var(--ink-3); }
.row-meta a { color: var(--ink-2); }
.row-stats { font-size: var(--fs-s); color: var(--ink-3); text-align: right; white-space: nowrap; }
.row-stats b { color: var(--ink-2); font-weight: 500; }

/* ---------- 按钮与表单 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--surface); color: var(--ink);
  font-size: var(--fs); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.btn-primary { background: var(--roundel); border-color: var(--roundel); color: #fff; font-weight: 500; }
.btn-primary:hover { background: var(--roundel-dark); border-color: var(--roundel-dark); color: #fff; }
.btn-danger { color: var(--danger); border-color: #e3b5b2; }
.btn-danger:hover { background: #fbeceb; color: var(--danger); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: rgba(0, 0, 0, .05); }
.btn-small { height: 28px; padding: 0 10px; font-size: var(--fs-s); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

.form { max-width: 640px; }
.form-row { margin-bottom: 14px; }
.form-row > label, .form-label { display: block; font-weight: 500; margin-bottom: 5px; }
.form-hint { font-size: var(--fs-s); color: var(--ink-3); margin-top: 4px; }
.form-error { font-size: var(--fs-s); color: var(--danger); margin-top: 4px; }
.input, .select, .textarea,
.form input[type="text"], .form input[type="password"], .form input[type="email"], .form input[type="number"], .form input[type="url"], .form select, .form textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--surface);
  line-height: 1.5;
}
.input:focus, .select:focus, .textarea:focus, .form input:focus, .form select:focus, .form textarea:focus { border-color: var(--roundel); box-shadow: var(--focus); outline: none; }
.form textarea, .textarea { min-height: 160px; resize: vertical; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }

/* ---------- 提示 ---------- */
.notice { border: 1px solid var(--line); border-left: 4px solid var(--steel); background: var(--surface); padding: 10px 14px; border-radius: var(--r-block); margin-bottom: 12px; font-size: var(--fs); }
.notice-info { border-left-color: var(--roundel); }
.notice-ok { border-left-color: var(--ok); }
.notice-warn { border-left-color: var(--warn); background: #fff8ec; }
.notice-error { border-left-color: var(--danger); background: #fdf1f0; }
.empty { padding: 28px 14px; text-align: center; color: var(--ink-3); }

/* ---------- 头像、用户名、时间 ---------- */
.avatar { display: inline-block; flex: none; border-radius: 3px; overflow: hidden; background: var(--surface-2); vertical-align: middle; }
.avatar img, .avatar-letter { display: block; width: 100%; height: 100%; object-fit: cover; }
.avatar-letter {
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600;
  background: hsl(var(--h, 210), 32%, 42%);
}
.av-xs { width: 24px; height: 24px; font-size: 12px; }
.av-s { width: 36px; height: 36px; font-size: 16px; }
.av-m { width: 48px; height: 48px; font-size: 20px; }
.av-l { width: 96px; height: 96px; font-size: 40px; }
.av-xl { width: 144px; height: 144px; font-size: 60px; }
.avatar:hover { text-decoration: none; }
.username { font-weight: 500; color: var(--ink); }
.username.is-admin { color: #b3261e; }
.username.is-mod { color: #2e7d4f; }
.username.is-gone { color: var(--ink-3); font-weight: 400; }
time { white-space: nowrap; }

/* ---------- 前缀标签 ---------- */
.pfx { display: inline-block; font-size: var(--fs-xs); line-height: 18px; padding: 0 6px; border-radius: var(--r-tag); color: #fff; vertical-align: 2px; margin-right: 6px; font-weight: 500; white-space: nowrap; }
.pfx-red { background: #b9403a; }
.pfx-orange { background: #c76a1d; }
.pfx-yellow { background: #b8921a; }
.pfx-green { background: #3f8a52; }
.pfx-teal { background: #2c8784; }
.pfx-blue { background: #2f6fa7; }
.pfx-purple { background: #7457a6; }
.pfx-gray { background: #7b8692; }

/* ---------- 分页 ---------- */
.pager { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 10px 0; }
.pager-num, .pager-step, .pager-gap {
  display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 30px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--surface); font-size: var(--fs-s); color: var(--ink-2);
}
.pager-num:hover, .pager-step:hover { background: var(--surface-2); text-decoration: none; }
.pager-num.is-current { background: var(--steel); border-color: var(--steel); color: #fff; font-weight: 600; }
.pager-gap { border-color: transparent; background: none; }

/* ---------- 统计小表（侧栏） ---------- */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: var(--fs-s); }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; text-align: right; color: var(--ink); }

/* ---------- 错误页 ---------- */
.error-msg { font-size: var(--fs-m); margin-bottom: 16px; }
.error-actions { display: flex; gap: 8px; }

/* ---------- 页脚 ---------- */
.footer { background: var(--gunmetal); color: #b9c3cc; margin-top: 24px; font-size: var(--fs-s); }
.footer-inner { padding-top: 20px; padding-bottom: 24px; display: grid; gap: 6px; }
.footer-brand { color: #fff; font-weight: 600; }
.footer-notice { margin: 0; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { color: #dfe5ea; }

/* ---------- 窄屏 ---------- */
@media (max-width: 1000px) {
  .layout.has-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  body { font-size: 15px; }
  .masthead { min-height: 56px; }
  .masthead-inner { padding-top: 8px; padding-bottom: 8px; }
  .brand-mark { width: 118px; }
  .brand-tag { display: none; }
  .masthead-search { width: auto; flex: 1; max-width: 200px; }
  .masthead-search button { display: none; }
  .masthead-search input { border-right: 1px solid rgba(255, 255, 255, .28); border-radius: var(--r-btn); height: 32px; }
  .banner-credit { display: none; }
  .nav-toggle {
    display: block; background: none; border: 0; color: #fff; padding: 0 14px; cursor: pointer; height: var(--nav-h);
  }
  .navlist { display: none; position: absolute; left: 0; right: 0; top: var(--nav-h); background: var(--gunmetal); flex-direction: column; padding: 4px 0 8px; box-shadow: 0 8px 16px rgba(0, 0, 0, .25); }
  .navlist.is-open { display: flex; }
  .navlist a { height: auto; padding: 10px 18px; border: 0; border-left: 3px solid transparent; }
  .navlist a[aria-current="page"] { border-left-color: var(--taxiway); }
  .navbar-inner { position: relative; padding: 0; }
  .navbar-user { margin-left: auto; }
  .usermenu-name { display: none; }
  .page { padding-top: 10px; }
  .page-title { font-size: var(--fs-m); }
  .row { padding: 10px 12px; }
  .row-stats { display: none; }
  .page-head-row { flex-direction: column; align-items: stretch; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- 后台菜单 ---------- */
.admin-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--gap); align-items: start; }
.admin-nav .row { padding: 0; }
.admin-nav .row-title { flex: 1; padding: 9px 14px; font-weight: 400; }
.admin-nav .row-title:hover { text-decoration: none; background: var(--surface-2); }
.admin-nav .row-title[aria-current="page"] { font-weight: 600; box-shadow: inset 3px 0 0 var(--taxiway); background: var(--surface-2); }
@media (max-width: 767px) { .admin-layout { grid-template-columns: minmax(0, 1fr); } }
