/* ==========================================================================
 * lelele-game · 社区讨论区样式
 *
 * 两处使用：index.html 全站论坛（cbox 聊天框）、game.html 每款游戏独立讨论区
 * （Remarkbox）。板式、配色、深色模式均沿用站点既有 CSS 变量。
 * ========================================================================== */

.forum-section {
    width: 100%;
    max-width: 1100px;
    margin: 44px auto 30px;
    padding: 0 20px;
    box-sizing: border-box;
}

.forum-card {
    background: var(--card-bg, rgba(255, 255, 255, .85));
    border: 1px solid var(--card-border, rgba(148, 163, 184, .15));
    border-radius: 20px;
    padding: 18px 18px 14px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .07);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.forum-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 2px 4px 14px;
}

.forum-icon {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    line-height: 1;
    background: linear-gradient(135deg, rgba(79, 70, 229, .16), rgba(79, 70, 229, .05));
    border: 1px solid rgba(79, 70, 229, .18);
}

.forum-head-text {
    min-width: 0;
}

.forum-title {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: .01em;
    color: var(--text-main, #1e293b);
    line-height: 1.45;
}

.forum-sub {
    margin: 4px 0 0;
    font-size: .84rem;
    line-height: 1.6;
    color: var(--text-muted, #64748b);
    word-break: break-word;
}

.forum-tip {
    margin: 0 0 12px;
    padding: 9px 12px;
    border-radius: 10px;
    background: rgba(129, 140, 248, .12);
    border: 1px solid rgba(129, 140, 248, .22);
    font-size: .8rem;
    line-height: 1.6;
    color: #4338ca;
    word-break: break-word;
}

html.dark-mode .forum-tip, html[data-theme="dark"] .forum-tip {
    background: rgba(129, 140, 248, .14);
    border-color: rgba(129, 140, 248, .28);
    color: #c7d2fe;
}

.forum-body {
    position: relative;
    min-height: 460px;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(148, 163, 184, .18);
}

.forum-body--game {
    min-height: 420px;
}

.forum-body iframe {
    display: block;
    width: 100%;
    border: 0 !important;
    background: #fff;
}

/* 加载占位：只在 iframe 就绪前显示 */
.forum-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    text-align: center;
    font-size: .88rem;
    color: #64748b;
    background: #fff;
    z-index: 1;
}

.forum-loading.forum-hidden {
    display: none;
}

.forum-spinner {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2.5px solid #e5e7eb;
    border-top-color: #4f46e5;
    animation: forumSpin .85s linear infinite;
}

@keyframes forumSpin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .forum-spinner { animation: none; }
}

/* 加载失败：给普通人读的一句话，不带任何技术信息 */
.forum-note {
    margin: 12px 4px 0;
    font-size: .8rem;
    line-height: 1.7;
    color: var(--text-muted, #64748b);
    text-align: center;
}

@media (max-width: 640px) {
    .forum-section {
        margin: 30px auto 22px;
        padding: 0 12px;
    }

    .forum-card {
        padding: 14px 12px 10px;
        border-radius: 16px;
    }

    .forum-body {
        min-height: 380px;
    }

    .forum-body--game {
        min-height: 360px;
    }
}

/* 断网时讨论区的提示（不挂 iframe，只给一句人话） */
.forum-offline {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 28px 16px; text-align: center; color: #64748b;
}
html.dark-mode .forum-offline { color: #8b96ab; }

/* ==================== 讨论区直达链接按钮（2026-11-29 新增，只追加）==================== */
.forum-link-btn {
    flex: 0 0 auto;
    margin-left: auto;
    padding: 7px 11px;
    font-size: .78rem;
    line-height: 1.2;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;
    border-radius: 9px;
    border: 1px solid var(--card-border, rgba(148, 163, 184, .4));
    background: transparent;
    color: var(--text-muted, #64748b);
    transition: background .15s, color .15s, border-color .15s;
}
.forum-link-btn:hover {
    border-color: rgba(79, 70, 229, .5);
    color: #4f46e5;
    background: rgba(79, 70, 229, .08);
}
.forum-link-btn.copied {
    border-color: rgba(22, 163, 74, .5);
    color: #15803d;
    background: rgba(22, 163, 74, .1);
}
html.dark-mode .forum-link-btn { color: #94a3b8; }
html.dark-mode .forum-link-btn:hover { color: #a5b4fc; background: rgba(99, 102, 241, .14); }
html.dark-mode .forum-link-btn.copied { color: #86efac; background: rgba(34, 197, 94, .16); }
@media (max-width: 520px) {
    .forum-head { flex-wrap: wrap; }
    .forum-link-btn { margin-left: 50px; }
}
/* to=forum 打开时高亮一下讨论区（2 秒淡出，不做动画也能看） */
.forum-section.forum-flash .forum-card {
    box-shadow: 0 0 0 2px rgba(79, 70, 229, .35);
    transition: box-shadow .4s ease;
}

/* ===== 讨论区「重新加载」按钮：常驻，标题右侧 ===== */
.forum-head { position: relative; }
.forum-head-actions { margin-left: auto; flex: 0 0 auto; }
.forum-reload {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 13px; border-radius: 999px;
    border: 1px solid rgba(79, 70, 229, .22);
    background: rgba(79, 70, 229, .08);
    color: #4f46e5; font-size: .78rem; font-weight: 700;
    cursor: pointer; white-space: nowrap;
    transition: background .18s ease, color .18s ease, opacity .18s ease;
}
.forum-reload:hover { background: #4f46e5; color: #fff; }
.forum-reload.is-loading { opacity: .6; cursor: progress; }
.forum-reload.is-loading .forum-reload-icon { display: inline-block; animation: forumSpin 1s linear infinite; }
@keyframes forumSpin { to { transform: rotate(360deg); } }
@media (max-width: 600px) {
    /* 手机上标题+简介会占满整行，按钮改为贴住标题右上角，避免被挤到简介下面 */
    .forum-reload { padding: 6px 10px; font-size: .74rem; }
    .forum-head-actions {
        position: absolute; top: 0; right: 0; margin: 0;
    }
    .forum-head-text { padding-right: 104px; }
    .forum-title { line-height: 1.35; }
}
