/**
 * board.css —— 版块页（公告页 / 社区页）共用的样式
 * 两页外壳完全一样，只有版块 key 和标题不同，所以样式抽在这里，改一次两页都变。
 */

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    background: #111827;          /* 站点仅黑夜模式，直接按深色渲染 */
    font-family: 'Inter', sans-serif;
    color: #e5e7eb;
    line-height: 1.5;
    min-height: 100vh;
    color-scheme: dark;
}

/* ===== 顶部导航（与其他页面一致）===== */
.topbar {
    background: #111827;
    border-bottom: 1px solid #374151;
    position: sticky;
    top: 0;
    z-index: 1000;
}
.topbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1.5rem;
}
.topbar-logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
}
.topbar-logo h1 i { color: #9ca3af; }
.wiki-nav {
    display: flex;
    gap: 1.1rem;
    list-style: none;
    margin-left: auto;
    flex-wrap: wrap;
}
.wiki-nav a {
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    transition: all 0.2s;
}
.wiki-nav a i { margin-right: 6px; color: #9ca3af; }
.wiki-nav a:hover { background: #374151; color: #e5e7eb; }

/* ===== 账号菜单 ===== */
.account-menu { position: relative; }
.account-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 999px;
    font-family: inherit;
    transition: background 0.15s;
}
.account-trigger:hover { background: #374151; }
.account-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #4b5563;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    overflow: hidden;
    flex-shrink: 0;
}
.account-avatar .avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.account-name { color: #e5e7eb; font-size: 0.85rem; font-weight: 500; }
.account-trigger .fa-chevron-down { font-size: 0.7rem; color: #9ca3af; }
.account-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    width: 300px;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 0.75rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    padding: 0.5rem;
    z-index: 1100;
}
.dropdown-meta {
    font-size: 0.75rem;
    color: #9ca3af;
    padding: 0.4rem 0.6rem 0.6rem;
    border-bottom: 1px solid #374151;
    word-break: break-all;
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 0.5rem 0.6rem;
    background: none;
    border: none;
    border-radius: 0.375rem;
    color: #e5e7eb;
    font-size: 0.85rem;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}
.dropdown-item:hover { background: #374151; }
.dropdown-item.danger { color: #f87171; }
.dropdown-item.danger:hover { background: #7f1d1d; color: #fca5a5; }
.acct-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;   /* 两列：密码和安全性 | 新闻推送 */
    gap: 2px;
    padding: 2px 0;
}
.acct-link {
    display: block;
    padding: 6px 8px;
    font-size: 0.82rem;
    color: #d1d5db;
    text-decoration: none;
    border-radius: 0.375rem;
    transition: background 0.15s, color 0.15s;
}
.acct-link:hover { background: #374151; color: #ffffff; }
.acct-sep { height: 1px; background: #374151; margin: 6px 2px; }
a.dropdown-item { text-decoration: none; }

/* ===== 主体 ===== */
.p-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}
/* 面包屑：论坛 › 新闻与公告 › 当前版块 */
.crumb {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.7rem;
    flex-wrap: wrap;
}
.crumb a { color: #9ca3af; text-decoration: none; }
.crumb a:hover { color: #e5e7eb; }
.crumb i { font-size: 0.6rem; }

.p-title {
    font-size: 1.7rem;
    font-weight: 700;
    color: #e5e7eb;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.p-title i { color: #9ca3af; }
.p-sub { color: #9ca3af; font-size: 0.9rem; margin-bottom: 1.8rem; }

/* 发布表单（仅工作人员可见） */
.card {
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #e5e7eb;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card h3 i { color: #9ca3af; font-size: 1rem; }
.card .card-desc { font-size: 0.82rem; color: #9ca3af; margin-bottom: 1.1rem; }
.form-group { margin-bottom: 0.9rem; }
.form-group label {
    display: block;
    font-size: 0.8rem;
    color: #9ca3af;
    margin-bottom: 0.3rem;
    font-weight: 500;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.55rem 0.8rem;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    color: #e5e7eb;
    background: #111827;
    outline: none;
    transition: border 0.2s;
    font-family: inherit;
}
.form-group textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: #64748b; }
.form-row { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.form-submit {
    padding: 0.6rem 1.5rem;
    background: #4a5568;
    border: none;
    border-radius: 0.5rem;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}
.form-submit:hover { background: #2c3e50; }
.form-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.form-msg { margin-top: 0.7rem; font-size: 0.85rem; min-height: 1.2em; }
.form-msg.error { color: #f87171; }
.form-msg.success { color: #4ade80; }
/* 没有发帖权限时，底部给一句提示（跟论坛一样） */
.no-perm {
    text-align: right;
    font-size: 0.8rem;
    color: #6b7280;
    margin: 0.4rem 0 1rem;
}

/* ===== 内容列表 ===== */
.news-item {
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 1rem;
    padding: 1.3rem 1.5rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}
.news-item:hover { border-color: #4b5563; }
.news-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}
.news-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #e6edf3;
    line-height: 1.35;
    word-break: break-word;
}
.news-tag {
    flex-shrink: 0;
    font-size: 0.72rem;
    padding: 0.12rem 0.6rem;
    border-radius: 999px;
    border: 1px solid;
    white-space: nowrap;
}
.tag-ann { color: #60a5fa; background: rgba(96,165,250,0.12); border-color: rgba(96,165,250,0.35); }
.tag-upd { color: #a78bfa; background: rgba(167,139,250,0.12); border-color: rgba(167,139,250,0.35); }
.tag-fix { color: #f87171; background: rgba(248,113,113,0.12); border-color: rgba(248,113,113,0.35); }
.tag-oth { color: #9ca3af; background: rgba(156,163,175,0.12); border-color: rgba(156,163,175,0.3); }
.news-meta {
    font-size: 0.78rem;
    color: #6b7280;
    margin-bottom: 0.7rem;
    font-family: 'Inter', monospace;
}
/* white-space: pre-wrap 让正文里的换行能正常显示 */
.news-body {
    font-size: 0.92rem;
    color: #cbd5e1;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}
/* 每条内容下面的操作按钮（工作人员才看得到） */
.news-actions { margin-top: 0.9rem; display: flex; gap: 8px; flex-wrap: wrap; }
.news-edit,
.news-del {
    padding: 0.35rem 0.9rem;
    background: none;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    color: #9ca3af;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}
.news-edit:hover { background: #374151; color: #e5e7eb; }
.news-del { border-color: #7f1d1d; color: #f87171; }
.news-del:hover { background: #7f1d1d; color: #fca5a5; }

/* 「取消编辑」按钮，平时不显示 */
.form-cancel {
    margin-left: 8px;
    padding: 0.6rem 1.2rem;
    background: none;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    color: #9ca3af;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}
.form-cancel:hover { background: #374151; color: #e5e7eb; }
.news-empty {
    text-align: center;
    padding: 3.5rem 1rem;
    color: #6b7280;
}
.news-empty i { font-size: 2rem; color: #374151; display: block; margin-bottom: 0.8rem; }

/* 公告页里的一行条目：已发布的公告、以及列表最下面的「论坛规则 / 游戏规则」入口，
   两种用的都是这个类，所以它们长得一模一样（规则那两行不再有任何置顶的样子） */
.entry-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0.9rem 1.25rem;
    margin-bottom: 1.2rem;
    background: #1f2937;
    border: 1px solid #374151;
    border-left: 3px solid #f87171;   /* 左边一竖红杠：所有条目统一的装饰，不代表置顶 */
    border-radius: 1rem;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s, border-color 0.2s;
}
.entry-row:hover { background: #263243; border-color: #4b5563; border-left-color: #f87171; }
.en-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 0.65rem;
    background: #111827;
    border: 1px solid #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 1.05rem;
}
.en-body { min-width: 0; }
.en-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 700;
    color: #e5e7eb;
}
/* 标题太长就省略，别把右边的「查看」挤出去 */
.en-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.en-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    /* 用长写法而不是 border 简写 —— 简写会把 border-color 重置成字色，
       把下面 .tag-ann / .tag-upd 那几套配色冲掉 */
    border-width: 1px;
    border-style: solid;
    white-space: nowrap;
    font-weight: 600;
    font-size: 0.68rem;
}
.en-desc {
    font-size: 0.78rem;
    color: #6b7280;
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.en-go {
    margin-left: auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #9ca3af;
}
.en-go i { font-size: 0.65rem; }

@media (max-width: 640px) {
    .en-desc { display: none; }
    .en-go span { display: none; }
}

/* ===== 公告详情页（post.html?id=N）=====
   版式跟论坛规则页共用 .rule-post / .rp-*，这里只补两处公告特有的。 */
.post-tools { justify-content: flex-start; margin: 0 0 1.5rem; }
/* 公告正文是随手写的自由文本，换行要原样保留（规则帖才走 ## / - 那套排版） */
.rp-body.post-plain { white-space: pre-wrap; }
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #9ca3af;
    text-decoration: none;
}
.back-link:hover { color: #e5e7eb; }
.back-link i { font-size: 0.75rem; }

/* ===== 偏好页（preferences.html）的开关 ===== */
.switch-row {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0.9rem 0 0.4rem;
    cursor: pointer;
}
.switch-txt { flex: 1; min-width: 0; }
.switch-name { font-size: 0.95rem; font-weight: 600; color: #e5e7eb; }
.switch-hint { display: block; font-size: 0.78rem; color: #6b7280; margin-top: 4px; line-height: 1.5; }
.switch {
    position: relative;
    flex: none;
    width: 48px;
    height: 27px;
}
.switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
.switch .slider {
    position: absolute;
    inset: 0;
    background: #374151;
    border-radius: 999px;
    transition: background 0.2s;
    pointer-events: none;       /* 点击一律交给上面那个 input */
}
.switch .slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: #9ca3af;
    transition: transform 0.2s, background 0.2s;
}
.switch input:checked + .slider { background: #16a34a; }
.switch input:checked + .slider::after { transform: translateX(21px); background: #ffffff; }
.switch input:focus-visible + .slider { outline: 2px solid #60a5fa; outline-offset: 2px; }
.switch input:disabled + .slider { opacity: 0.6; }

.pref-note { font-size: 0.8rem; color: #6b7280; margin-top: 0.2rem; }

/* ===== 帖子的「左作者栏 + 右正文」版式 =====
   现在只有公告详情页 post.html 在用（论坛规则 / 游戏规则那两页已经拆掉了）。
   左边一条窄的作者栏，右边是正文，跟常见论坛的帖一个样子。 */
.rule-post {
    display: grid;
    grid-template-columns: 128px 1fr;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 1.2rem;
}
.rp-side {
    padding: 0.7rem 0.6rem;
    text-align: center;
    background: #1a2231;
    border-right: 1px solid #374151;
}
/* 作者那一块整体可点：跟在线玩家一样，点一下弹资料卡，再点一下进主页 */
.rp-who {
    display: block;
    padding: 0.5rem 0.2rem 0.4rem;
    border-radius: 0.7rem;
    cursor: pointer;
    transition: background 0.15s;
}
.rp-who:hover { background: rgba(255,255,255,0.05); }
.rp-av {
    width: 64px;
    height: 64px;
    margin: 0 auto 0.55rem;
    border-radius: 50%;
    background: #374151;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
}
.rp-av .avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rp-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: #e5e7eb;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.3;
}
.rp-role {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 0.45rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    border: 1px solid;
    font-size: 0.68rem;
    white-space: nowrap;
}
/* 身份标签的配色统一在 role.css 里（.rp-role.owner / .rp-role.vip），这儿不再各写一份 */

.rp-main { padding: 1.1rem 1.4rem 1.4rem; min-width: 0; }
.rp-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.78rem;
    color: #6b7280;
    margin-bottom: 0.9rem;
    font-family: 'Inter', monospace;
}

.rp-body { color: #cbd5e1; font-size: 0.92rem; line-height: 1.75; }

.rp-edited {
    margin-top: 1.6rem;
    padding-top: 0.9rem;
    border-top: 1px solid #374151;
    text-align: right;
    font-size: 0.75rem;
    color: #4b5563;
    font-family: 'Inter', monospace;
}

/* 表单里的写法提示 */
.card-desc code {
    background: #111827;
    border: 1px solid #374151;
    border-radius: 4px;
    padding: 0 4px;
    font-family: 'Inter', monospace;
    font-size: 0.78rem;
    color: #cbd5e1;
}

.notice-login { text-align: center; padding: 3rem 1rem; color: #9ca3af; }
.notice-login .big { font-size: 1.3rem; margin-bottom: 0.5rem; color: #e5e7eb; }

.wiki-footer {
    margin-top: 3rem;
    padding: 1.6rem 1rem 1.4rem;
    border-top: 1px solid #374151;
    text-align: center;
    color: #6b7280;
    font-size: 0.85rem;
    background: #1c2537;   /* 整条通栏浅色（页脚已移到内容容器外，所以能铺满整宽） */
}

@media (max-width: 640px) {
    .wiki-nav { display: none; }
    .form-row { grid-template-columns: 1fr; }

    /* 窄屏：作者栏横过来放到顶上，不然一列窄栏会挤掉正文宽度 */
    .rule-post { grid-template-columns: 1fr; }
    .rp-side {
        display: flex;
        align-items: center;
        gap: 10px;
        text-align: left;
        padding: 0.8rem 1rem;
        border-right: none;
        border-bottom: 1px solid #374151;
    }
    .rp-who { display: flex; align-items: center; gap: 10px; flex: 1; padding: 0; min-width: 0; }
    .rp-av { width: 38px; height: 38px; margin: 0; font-size: 0.95rem; flex-shrink: 0; }
    .rp-role { margin-top: 0; }
    .rp-main { padding: 1rem; }
}
