/* ==========================================================================
   莆田学院院校论坛 —— 复古论坛风格 / 移动端优先
   ========================================================================== */

:root {
    --bg:        #dfe7f0;
    --panel:     #ffffff;
    --line:      #b8cde3;
    --line-soft: #e2ecf6;
    --head-1:    #3a76b4;
    --head-2:    #24578d;
    --link:      #1a5490;
    --text:      #2b3a4a;
    --muted:     #7d8fa1;
    --accent:    #e8641c;
    --ok:        #2e8b57;
    --danger:    #c0392b;
    --radius:    3px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.65 -apple-system, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", Tahoma, Arial, sans-serif;
    padding-bottom: calc(56px + env(safe-area-inset-bottom));
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

/* ---------- 顶部 ---------- */

.topbar {
    position: sticky; top: 0; z-index: 50;
    background: linear-gradient(180deg, var(--head-1), var(--head-2));
    border-bottom: 1px solid #1b4470;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.topbar-inner {
    max-width: 980px; margin: 0 auto;
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px;
}
.logo { display: flex; align-items: center; gap: 8px; color: #fff; flex: 1; min-width: 0; }
.logo:hover { text-decoration: none; }
.logo-mark {
    width: 32px; height: 32px; flex: 0 0 32px;
    display: grid; place-items: center;
    background: linear-gradient(180deg, #ffd76e, #f0a422);
    border: 1px solid #b8791a; border-radius: var(--radius);
    font-size: 17px; box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}
.logo-text { min-width: 0; }
.logo-name {
    font-size: 16px; font-weight: 700; letter-spacing: .5px;
    text-shadow: 0 1px 0 rgba(0,0,0,.35);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.logo-sub { font-size: 10px; color: #c9e0f6; letter-spacing: 2px; }

.topnav { display: none; gap: 2px; }
.topnav a {
    color: #e8f2fb; font-size: 13px; padding: 5px 11px; border-radius: var(--radius);
}
.topnav a:hover { background: rgba(255,255,255,.16); text-decoration: none; }
.topnav a.on { background: rgba(255,255,255,.24); color: #fff; font-weight: 700; }

.userbox { display: flex; align-items: center; gap: 8px; }
.userbox .uname {
    color: #fff; font-size: 13px; max-width: 96px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 主体容器 ---------- */

.wrap { max-width: 980px; margin: 0 auto; padding: 10px 10px 24px; }

.crumb {
    font-size: 12px; color: var(--muted);
    padding: 6px 10px; margin-bottom: 8px;
    background: linear-gradient(180deg, #f7fbff, #eaf2fa);
    border: 1px solid var(--line); border-radius: var(--radius);
}
.crumb a { color: var(--link); }
.crumb .sep { margin: 0 4px; color: #a8bccd; }

.statbar {
    display: flex; flex-wrap: wrap; gap: 4px 14px;
    font-size: 12px; color: #4a5d70;
    padding: 7px 10px; margin-bottom: 10px;
    background: #f2f8fd; border: 1px solid var(--line);
    border-left: 3px solid var(--head-1); border-radius: var(--radius);
}
.statbar b { color: var(--accent); }

.notice {
    padding: 8px 10px; margin-bottom: 10px; font-size: 13px;
    background: #fff9e6; border: 1px solid #f0dca6; border-radius: var(--radius);
    color: #8a6413;
}

/* ---------- 面板 ---------- */

.panel {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); margin-bottom: 12px; overflow: hidden;
}
.panel-head {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px;
    background: linear-gradient(180deg, #f4f9fe, #e3edf8);
    border-bottom: 1px solid var(--line);
    font-size: 14px; font-weight: 700; color: #1d4b7d;
}
.panel-head .spacer { flex: 1; }
.panel-head .hint { font-size: 12px; font-weight: 400; color: var(--muted); }
.panel-body { padding: 10px; }
.panel-body.tight { padding: 0; }

/* ---------- 按钮 ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    padding: 8px 14px; font-size: 14px; font-family: inherit;
    color: #fff; cursor: pointer;
    background: linear-gradient(180deg, #4a8ac8, #2a5f96);
    border: 1px solid #1d4b7d; border-radius: var(--radius);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
    text-decoration: none; line-height: 1.2;
}
.btn:hover { text-decoration: none; filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn.ghost {
    background: linear-gradient(180deg, #fff, #eef4fa);
    color: #23557f; border-color: var(--line);
    box-shadow: inset 0 1px 0 #fff;
}
.btn.warn  { background: linear-gradient(180deg, #e5804f, #cf5a25); border-color: #a94a1d; }
.btn.danger{ background: linear-gradient(180deg, #d9605a, #b83a34); border-color: #932c27; }
.btn.ok    { background: linear-gradient(180deg, #56ac7c, #2e8b57); border-color: #236c44; }
.btn.sm    { padding: 4px 9px; font-size: 12px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---------- 表单 ---------- */

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: #3c5266; margin-bottom: 4px; font-weight: 700; }
.input, .textarea, .select {
    width: 100%; padding: 9px 10px; font-size: 15px; font-family: inherit;
    color: var(--text); background: #fff;
    border: 1px solid #a9c2da; border-radius: var(--radius);
    box-shadow: inset 0 1px 3px rgba(30,70,110,.12);
    outline: none;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--head-1); box-shadow: 0 0 0 3px rgba(58,118,180,.18); }
.textarea { resize: vertical; min-height: 110px; line-height: 1.7; }
.form-tip { font-size: 12px; color: var(--muted); margin-top: 4px; }

.row2 { display: grid; gap: 10px; grid-template-columns: 1fr; }

/* ---------- 标签 ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    font-size: 12px; padding: 4px 10px; border-radius: 12px; cursor: pointer;
    background: #eef5fc; border: 1px solid var(--line); color: #2a5f96;
}
.chip.on { background: linear-gradient(180deg, #4a8ac8, #2a5f96); color: #fff; border-color: #1d4b7d; }

.tag {
    display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 2px;
    background: #e8f1fa; border: 1px solid #c3d8ec; color: #2a5f96; vertical-align: 1px;
}
.tag.pin { background: #fdeee0; border-color: #f0c9a3; color: #b4560f; }

.badge {
    display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 2px;
    background: #eef2f6; border: 1px solid #d3dde7; color: #5d7a94;
}
.badge.owner { background: #fdeee0; border-color: #f0c9a3; color: #b4560f; }
.badge.admin { background: #e9f0fd; border-color: #b9cdf0; color: #2352a0; }
.badge.mod   { background: #e9f7ee; border-color: #b3ddc5; color: #23754a; }

.avatar {
    width: 40px; height: 40px; flex: 0 0 40px;
    display: grid; place-items: center; font-size: 21px;
    background: linear-gradient(180deg, #f7fbff, #dfeaf5);
    border: 1px solid var(--line); border-radius: var(--radius);
}
.avatar.sm { width: 30px; height: 30px; flex-basis: 30px; font-size: 16px; }
.avatar.lg { width: 56px; height: 56px; flex-basis: 56px; font-size: 30px; }

/* ---------- 帖子列表 ---------- */

.post-item {
    display: flex; gap: 10px; padding: 10px;
    border-bottom: 1px solid var(--line-soft);
}
.post-item:last-child { border-bottom: 0; }
.post-item:nth-child(even) { background: #fafcfe; }
.post-item .meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; }
.post-item .title { font-size: 15px; font-weight: 700; line-height: 1.45; }
.post-item .title a { color: #1a4f86; }
.post-item .summary { font-size: 13px; color: #5c6f80; margin-top: 3px; }

/* ---------- 分区列表 ---------- */

.board-item {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 10px; border-bottom: 1px solid var(--line-soft);
}
.board-item:last-child { border-bottom: 0; }
.board-item:nth-child(even) { background: #fafcfe; }
.board-icon {
    width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center;
    font-size: 21px; border-radius: var(--radius);
    background: linear-gradient(180deg, #f7fbff, #dfeaf5); border: 1px solid var(--line);
}
.board-main { flex: 1; min-width: 0; }
.board-name { font-size: 15px; font-weight: 700; color: #1a4f86; }
.board-desc { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-stat { font-size: 11px; color: #8497a8; margin-top: 3px; }
.board-last { display: none; font-size: 12px; color: var(--muted); width: 150px; flex: 0 0 150px; }

/* ---------- 聊天 ---------- */

.chat-head {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px;
    background: linear-gradient(180deg, #f4f9fe, #e3edf8);
    border-bottom: 1px solid var(--line);
}
.chat-head .board-name { font-size: 15px; }
.chat-scroll {
    height: calc(100vh - 300px); min-height: 300px; overflow-y: auto;
    padding: 10px; background: #f7fafd;
    -webkit-overflow-scrolling: touch;
}
.msg { display: flex; gap: 8px; margin-bottom: 12px; }
.msg .bubble-wrap { min-width: 0; flex: 1; }
.msg .who { font-size: 12px; color: var(--muted); margin-bottom: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.msg .who .nick { color: #35618c; font-weight: 700; }
.msg .bubble {
    display: inline-block; max-width: 100%;
    padding: 7px 11px; font-size: 14px; line-height: 1.6;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(30,70,110,.07);
    word-break: break-word; overflow-wrap: anywhere;
}
.msg.mine .bubble { background: #e8f3e9; border-color: #bcdcc3; }
.msg .ops { font-size: 11px; color: #a4b3c1; margin-top: 2px; }
.msg .ops button {
    background: none; border: 0; color: #a4b3c1; font-size: 11px; cursor: pointer; padding: 0 4px;
}
.msg .ops button:hover { color: var(--danger); }
.msg.sys { justify-content: center; }
.msg.sys .bubble { background: #f0f2f5; color: var(--muted); font-size: 12px; border-style: dashed; }

.chat-input {
    display: flex; gap: 8px; padding: 8px 10px; align-items: flex-end;
    background: #fff; border-top: 1px solid var(--line);
}
.chat-input .input { flex: 1; box-shadow: inset 0 1px 3px rgba(30,70,110,.12); }
.emoji-bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 10px 0; background: #fff; }
.emoji-bar button {
    font-size: 19px; background: none; border: 1px solid transparent; border-radius: var(--radius);
    cursor: pointer; padding: 1px 4px;
}
.emoji-bar button:hover { background: #eef5fc; border-color: var(--line); }

/* ---------- 楼层 / 回复 ---------- */

.floor {
    display: flex; gap: 10px; padding: 10px;
    border-bottom: 1px solid var(--line-soft);
}
.floor:last-child { border-bottom: 0; }
.floor .floor-side { display: none; width: 130px; flex: 0 0 130px; text-align: center; }
.floor .floor-num { font-size: 12px; color: var(--muted); }
.floor .floor-body { flex: 1; min-width: 0; }
.floor .floor-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.floor .floor-content { margin-top: 6px; font-size: 14px; line-height: 1.75; word-break: break-word; overflow-wrap: anywhere; }

.article-title { font-size: 19px; font-weight: 700; line-height: 1.45; margin: 2px 0 8px; color: #173d63; }
.article-meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.article-body { font-size: 15px; line-height: 1.85; word-break: break-word; overflow-wrap: anywhere; }
.article-body blockquote {
    margin: 8px 0; padding: 6px 10px; font-size: 13px; color: #5c6f80;
    background: #f5f8fb; border-left: 3px solid #b8cde3;
}
.article-body pre.code {
    background: #f5f8fb; border: 1px solid var(--line-soft); border-radius: var(--radius);
    padding: 8px; overflow-x: auto; font-size: 13px; font-family: Consolas, Monaco, monospace;
}
.article-body a { word-break: break-all; }

/* ---------- 底部导航（移动端） ---------- */

.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    display: flex;
    background: linear-gradient(180deg, #f7fbff, #e6eef7);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -1px 6px rgba(30,70,110,.12);
}
.tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 7px 2px 6px; font-size: 11px; color: #5b7085;
}
.tabbar a:hover { text-decoration: none; }
.tabbar a .ico { font-size: 19px; line-height: 1; }
.tabbar a.on { color: #1d4b7d; font-weight: 700; background: rgba(58,118,180,.10); }
.tabbar a.mid .ico { font-size: 23px; }

/* ---------- 杂项 ---------- */

.empty { padding: 34px 12px; text-align: center; color: var(--muted); font-size: 13px; }
.empty .ico { font-size: 34px; display: block; margin-bottom: 8px; opacity: .5; }

.pager { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px; font-size: 13px; }
.pager .cur { color: var(--muted); }

.list-row {
    display: flex; align-items: center; gap: 8px; padding: 9px 10px;
    border-bottom: 1px solid var(--line-soft); font-size: 13px;
}
.list-row:last-child { border-bottom: 0; }
.list-row:nth-child(even) { background: #fafcfe; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .sub { font-size: 11px; color: var(--muted); }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 7px 8px; text-align: left; border-bottom: 1px solid var(--line-soft); }
.tbl th { background: #f1f7fc; color: #35618c; font-weight: 700; white-space: nowrap; }
.tbl tr:nth-child(even) td { background: #fafcfe; }
.tbl-wrap { overflow-x: auto; }

.seg { display: flex; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg button {
    flex: 1; padding: 8px 6px; font-size: 13px; font-family: inherit; cursor: pointer;
    background: linear-gradient(180deg, #fff, #eef4fa); border: 0; border-right: 1px solid var(--line);
    color: #23557f;
}
.seg button:last-child { border-right: 0; }
.seg button.on { background: linear-gradient(180deg, #4a8ac8, #2a5f96); color: #fff; font-weight: 700; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.avatar-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-picker button {
    width: 40px; height: 40px; font-size: 21px; cursor: pointer;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
}
.avatar-picker button.on { border-color: var(--head-1); box-shadow: 0 0 0 3px rgba(58,118,180,.2); }

.footer {
    max-width: 980px; margin: 0 auto; padding: 14px 12px 20px;
    font-size: 11px; color: #8fa1b2; text-align: center; line-height: 1.9;
}

.toast {
    position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
    z-index: 200; max-width: 88vw;
    padding: 9px 16px; font-size: 13px; color: #fff;
    background: rgba(35,55,75,.94); border-radius: 18px;
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
    animation: toast-in .18s ease-out;
}
.toast.err { background: rgba(170,45,38,.95); }
.toast.ok  { background: rgba(35,120,72,.95); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.boot-loading { padding: 60px 20px; text-align: center; color: var(--muted); font-size: 14px; }

.spinner {
    width: 18px; height: 18px; display: inline-block; vertical-align: -3px;
    border: 2px solid #cfe0f0; border-top-color: #2a5f96; border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   桌面端增强
   ========================================================================== */

@media (min-width: 768px) {
    body { font-size: 13px; padding-bottom: 0; }
    .wrap { padding: 12px 12px 30px; }

    .topnav { display: flex; }
    .tabbar { display: none; }

    .logo-name { font-size: 18px; }
    .userbox .uname { max-width: 140px; font-size: 12px; }

    .row2 { grid-template-columns: 1fr 1fr; }
    .row2.three { grid-template-columns: 1fr 1fr 1fr; }

    .board-last { display: block; }
    .board-icon { width: 46px; height: 46px; flex-basis: 46px; font-size: 23px; }

    .floor .floor-side { display: block; }
    .article-title { font-size: 21px; }

    .chat-scroll { height: 460px; }
    .chat-input .input { font-size: 14px; }

    .post-item .title { font-size: 14px; }
    .board-name { font-size: 14px; }
}

@media (min-width: 1000px) {
    .chat-scroll { height: 520px; }
}

/* ==========================================================================
   自定义图标系统（全部为内联 SVG，不依赖系统 emoji 字体）
   ========================================================================== */

/* 界面线性图标：尺寸跟随文字大小，颜色跟随 currentColor */
.ico-svg {
    width: 1.05em; height: 1.05em;
    display: inline-block; vertical-align: -0.16em;
    flex: 0 0 auto;
}

/* 顶部校徽 */
.logo-mark { overflow: hidden; padding: 0; }
.logo-mark .logo-svg { width: 25px; height: 25px; display: block; }

/* 会员头像：容器裁切，SVG 铺满 */
.avatar { overflow: hidden; padding: 0; }
.avatar .av-svg { width: 100%; height: 100%; display: block; border-radius: inherit; }

/* 分区图标 */
.board-icon { overflow: hidden; padding: 0; }
.board-icon .bd-svg { width: 100%; height: 100%; display: block; }

/* 头像 / 图标选择器 */
.avatar-picker button { padding: 0; overflow: hidden; display: grid; place-items: center; }
.avatar-picker button .av-svg,
.avatar-picker button .bd-svg { width: 100%; height: 100%; display: block; }

/* 聊天分区头部图标 */
.chat-head .bd-svg { width: 34px; height: 34px; display: block; }

/* 后台分区列表图标 */
.bd-svg-wrap { flex: 0 0 auto; }
.bd-svg-wrap .bd-svg { width: 32px; height: 32px; display: block; }

/* 表情：正文 / 气泡内联 */
.emo { width: 20px; height: 20px; display: inline-block; vertical-align: -4px; }

/* 表情选择条 */
.emoji-bar button { padding: 2px; line-height: 0; }
.emoji-bar button .emo { width: 22px; height: 22px; }

/* 空状态大图标 */
.empty .ico { line-height: 0; }
.empty .ico .ico-svg { width: 34px; height: 34px; vertical-align: 0; }

/* 底部标签栏图标 */
.tabbar a .ico { line-height: 0; }

