:root {
    --primary: #00f2ff;
    --primary-glow: rgba(0, 242, 255, 0.4);
    --bg-deep: #020409;
    --glass: rgba(18, 22, 32, 0.85);
    --border: rgba(255, 255, 255, 0.1);
    --text-sub: #94a3b8;
    --success: #00e676;
    --error: #ff4d4d;
    --warning: #ff9f43;
    --danger: #ff4757;
    /* Extended variables for theme support */
    --shadow-heavy: rgba(0,0,0,0.8);
    --shadow-medium: rgba(0,0,0,0.5);
    --shadow-light: rgba(0,0,0,0.2);
    --text-primary: #fff;
    --text-secondary: #ccc;
    --text-muted: #888;
    --text-label: #666;
    --nav-bg: rgba(10, 12, 18, 0.6);
    --nav-border: rgba(255,255,255,0.05);
    --input-bg: rgba(0,0,0,0.3);
    --input-bg-focus: rgba(0,0,0,0.5);
    --input-border: var(--border);
    --input-label-bg: #151a23;
    --btn-text: #000;
    --btn-back-bg: rgba(255,255,255,0.1);
    --btn-back-hover: rgba(255,255,255,0.2);
    --btn-back-text: #fff;
    --btn-secondary-bg: #333;
    --btn-page-bg: #222;
    --btn-page-border: #444;
    --btn-page-text: #ccc;
    --card-bg: linear-gradient(145deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
    --card-bg-hover: rgba(0,242,255,0.03);
    --icon-glow: drop-shadow(0 0 15px rgba(255,255,255,0.2));
    --icon-glow-hover: drop-shadow(0 0 20px var(--primary));
    --list-bg: rgba(30, 35, 45, 0.5);
    --list-bg-hover: rgba(0,242,255,0.05);
    --forum-bg: rgba(25, 30, 40, 0.4);
    --msg-bg: rgba(0,0,0,0.3);
    --input-box-bg: rgba(20, 25, 35, 0.8);
    --msg-input-bg: rgba(255, 255, 255, 0.08);
    --msg-input-border: rgba(255, 255, 255, 0.2);
    --msg-input-text: #fff;
    --msg-input-placeholder: rgba(255, 255, 255, 0.4);
    --msg-input-focus-bg: rgba(255, 255, 255, 0.12);
    --overlay-bg: #080b12;
    --admin-h-border: #333;
    --stat-bg: #131824;
    --stat-border: #333;
    --stat-bg-hover: #1a202d;
    --data-panel-bg: #131824;
    --data-panel-border: #333;
    --table-text: #ccc;
    --table-th-text: #777;
    --table-th-border: #444;
    --table-td-border: #222;
    --m-content-bg: #1a1a20;
    --m-content-border: #444;
    --m-content-shadow: rgba(0,0,0,0.7);
    --edit-input-bg: #222;
    --edit-input-border: #444;
    --edit-input-text: #fff;
    --level-btn-bg: rgba(255, 255, 255, 0.1);
    --level-btn-unlocked-bg: rgba(255, 255, 255, 0.15);
    --level-btn-unlocked-border: rgba(255, 255, 255, 0.3);
    --timeline-border: #333;
    --t-content-bg: rgba(255,255,255,0.05);
    --t-content-border: #333;
    --t-content-text: #ddd;
    --toast-bg: rgba(255,255,255,0.95);
    --toast-text: #000;
    --toast-shadow: rgba(0,0,0,0.3);
    --progress-bg: #131824;
    --progress-header-bg: #080b12;
    --user-cell-bg: #1a202d;
    --p-cell-bg: #131824;
    --p-cell-border: #222;
    --lb-item-border: #333;
    --lb-name-color: #fff;
    --cert-overlay-bg: rgba(0,0,0,0.95);
    --cert-border: #333;
    --hero-title-from: #ffffff;
    --hero-title-to: #b0c4de;
    --hero-title-shadow: 0 10px 30px rgba(0,0,0,0.5);
    --hero-subtitle-shadow: 0 0 15px var(--primary-glow);
    --hero-stats-bg: rgba(255, 255, 255, 0.05);
    --hero-stats-border: rgba(255, 255, 255, 0.1);
    --hero-stats-text: #bbb;
    --hero-stats-shadow: 0 5px 20px rgba(0,0,0,0.2);
    --brand-title-from: #fff;
    --brand-title-to: var(--primary);
    --brand-title-shadow: 0 0 30px var(--primary-glow);
    --auth-overlay-bg: rgba(0,0,0,0.6);
    --switch-link-color: #666;
    --switch-link-hover: #fff;
    --footer-color: rgba(255, 255, 255, 0.3);
    --footer-border: rgba(255,255,255,0.02);
    --modal-overlay-bg: rgba(0,0,0,0.9);
    --modal-overlay-bg-heavy: rgba(0,0,0,0.95);
    --scrollbar-thumb: #333;
    --map-cell-bg: rgba(255,255,255,0.05);
    --map-cell-border: rgba(255,255,255,0.1);
    --map-cell-text: #555;
    --chal-hud-bg: rgba(255, 255, 255, 0.05);
    --chal-hud-border: rgba(255, 255, 255, 0.1);
    --cs-val-color: #fff;
    --stat-item-icon-text: #fff;
    --admin-h-title: #fff;
    --detail-border: #333;
    --cert-close-bg: rgba(255,255,255,0.1);
    --cert-close-border: rgba(255,255,255,0.2);
    --cert-close-text: #fff;
    --cert-close-hover: rgba(255,255,255,0.2);
    --upload-btn-bg: rgba(255,255,255,0.05);
    --upload-btn-border: rgba(255,255,255,0.2);
    --upload-btn-text: #fff;
    --img-preview-bg: rgba(255,255,255,0.1);

    /* ============================================================
       FluidLab AI 模块样式变量 (Phase 2)
       ============================================================ */
    --ai-bg-deep: #08090d;
    --ai-glass: rgba(18, 22, 32, 0.85);
    --ai-glass-hover: rgba(28, 32, 42, 0.9);
    --ai-primary: #00f2ff;
    --ai-primary-glow: rgba(0, 242, 255, 0.4);
    --ai-primary-dim: rgba(0, 242, 255, 0.15);
    --ai-border: rgba(255, 255, 255, 0.1);
    --ai-border-hover: rgba(0, 242, 255, 0.3);
    --ai-text-primary: #fff;
    --ai-text-secondary: #94a3b8;
    --ai-text-muted: #666;
    --ai-success: #00e676;
    --ai-error: #ff4d4d;
    --ai-warning: #ff9f43;
    --ai-danger: #ff4757;
    --ai-socratic: #ffd93d;
    --ai-socratic-border: rgba(255, 217, 61, 0.3);
    --ai-shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
    --ai-shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.7);
    --ai-radius-sm: 6px;
    --ai-radius-md: 12px;
    --ai-radius-lg: 16px;
    --ai-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Override grid layout on #level-map for chapter navigation */
#level-map { display: block; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; outline: none; }
body { margin: 0; padding: 0; background-color: var(--bg-deep); color: var(--text-primary); font-family: "Inter", sans-serif; height: 100vh; width: 100vw; overflow-x: hidden; overflow-y: auto; display: flex; flex-direction: column; }
#bg-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
::-webkit-scrollbar { width: 6px; height: 6px; } ::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; } ::-webkit-scrollbar-thumb:hover { background: var(--primary); }
#view-auth { position: fixed; z-index: 100; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(12px); background: var(--auth-overlay-bg); }
.auth-card { background: var(--glass); border: 1px solid var(--border); border-radius: 24px; padding: 50px 40px; width: 420px; max-width: 90%; text-align: center; box-shadow: 0 40px 100px var(--shadow-heavy); position: relative; overflow: hidden; animation: floatUp 0.8s ease-out; }
@keyframes floatUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.brand-title { font-size: 38px; font-weight: 900; margin: 0 0 10px 0; letter-spacing: -1px; background: linear-gradient(135deg, var(--brand-title-from) 30%, var(--brand-title-to)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; text-shadow: var(--brand-title-shadow); }
.welcome-text { font-size: 14px; color: var(--text-sub); margin-bottom: 35px; letter-spacing: 1px; }
.input-group { position: relative; margin-bottom: 20px; text-align: left; }
.auth-input { width: 100%; padding: 16px; border-radius: 12px; background: var(--input-bg); border: 1px solid var(--input-border); color: var(--text-primary); font-size: 16px; transition: 0.3s; }
.auth-input:focus { background: var(--input-bg-focus); border-color: var(--primary); box-shadow: 0 0 0 4px rgba(0, 242, 255, 0.1); transform: translateY(-2px); }
.auth-input::placeholder { color: transparent; }
.input-label { position: absolute; left: 16px; top: 16px; font-size: 15px; color: var(--text-label); pointer-events: none; transition: 0.2s ease-out; }
.auth-input:focus ~ .input-label, .auth-input:not(:placeholder-shown) ~ .input-label { top: -10px; left: 12px; font-size: 11px; color: var(--primary); background: var(--input-label-bg); padding: 0 6px; }
.btn-main { width: 100%; padding: 16px; margin-top: 15px; border: none; border-radius: 12px; background: linear-gradient(135deg, #0066ff, var(--primary)); color: var(--btn-text); font-weight: 800; font-size: 16px; cursor: pointer; transition: 0.2s; box-shadow: 0 10px 30px -10px var(--primary-glow); }
.btn-main:hover { transform: translateY(-3px); filter: brightness(1.1); box-shadow: 0 15px 40px -10px var(--primary-glow); }
.btn-main:active { transform: scale(0.98); }
.btn-main:disabled { filter: grayscale(1); opacity: 0.7; cursor: not-allowed; }
.switch-link { margin-top: 25px; font-size: 13px; color: var(--switch-link-color); cursor: pointer; transition: 0.2s; }
.switch-link:hover { color: var(--switch-link-hover); } .switch-link span { color: var(--primary); font-weight: bold; }
.error-toast { color: var(--error); font-size: 13px; margin-top: 15px; min-height: 20px; opacity: 0; transition: 0.3s; font-weight: 500; } .error-toast.show { opacity: 1; }
#app-container { display: none; width: 100%; height: 100%; flex-direction: column; }
.navbar { height: 60px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; background: var(--nav-bg); border-bottom: 1px solid var(--nav-border); backdrop-filter: blur(10px); z-index: 50; }
.main-content { flex: 1; position: relative; overflow-x: hidden; overflow-y: auto; display: flex; flex-direction: column; }
#menu-view { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 40px 20px; overflow-y: auto; }
.hero-section { text-align: center; margin-top: 2vh; margin-bottom: 40px; animation: fadeInDown 1s ease-out; position: relative; z-index: 1; }
.hero-title { font-size: 48px; font-weight: 800; margin: 0; letter-spacing: 2px; background: linear-gradient(180deg, var(--hero-title-from) 20%, var(--hero-title-to) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; text-shadow: var(--hero-title-shadow); line-height: 1.2; word-break: break-word; max-width: 100%; }
.hero-subtitle { font-size: 16px; color: var(--primary); text-transform: uppercase; letter-spacing: 4px; margin-top: 10px; opacity: 0.8; font-weight: 600; text-shadow: var(--hero-subtitle-shadow); }
.hero-stats { margin-top: 20px; display: inline-flex; align-items: center; gap: 20px; background: var(--hero-stats-bg); border: 1px solid var(--hero-stats-border); padding: 8px 25px; border-radius: 50px; font-size: 13px; color: var(--hero-stats-text); backdrop-filter: blur(5px); box-shadow: var(--hero-stats-shadow); }
.hero-stats b { color: var(--primary); font-size: 15px; margin: 0 3px; text-shadow: 0 0 10px rgba(0, 242, 255, 0.3); } .hero-stats .divider { color: var(--border); font-size: 16px; }
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; width: 100%; max-width: 1100px; margin-bottom: auto; animation: fadeInUp 1s ease-out 0.2s backwards; }
@keyframes fadeInDown { from{opacity:0; transform:translateY(-30px);} to{opacity:1; transform:translateY(0);} } @keyframes fadeInUp { from{opacity:0; transform:translateY(30px);} to{opacity:1; transform:translateY(0);} }
.menu-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 20px; padding: 50px 20px; text-align: center; cursor: pointer; transition: 0.3s; backdrop-filter: blur(5px); }
.menu-card:hover { transform: translateY(-10px); border-color: var(--primary); background: var(--card-bg-hover); box-shadow: 0 20px 40px var(--shadow-light); }
.menu-icon { font-size: 50px; margin-bottom: 20px; filter: var(--icon-glow); transition: 0.3s; }
.menu-card:hover .menu-icon { transform: scale(1.1); filter: var(--icon-glow-hover); }
.app-footer { width: 100%; text-align: center; padding: 20px; color: var(--footer-color); font-size: 13px; font-weight: 300; letter-spacing: 1px; border-top: 1px solid var(--footer-border); margin-top: 30px; animation: fadeIn 1.5s ease-in; }
@keyframes fadeIn { from{opacity:0;} to{opacity:1;} }
.sub-view { position: absolute; inset: 0; background: var(--bg-deep); display: none; flex-direction: column; z-index: 10; }
.sub-header { padding: 15px 30px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.btn-back { background: var(--btn-back-bg); border:none; color:var(--btn-back-text); padding:8px 16px; border-radius:20px; cursor:pointer; font-weight:bold; font-size:13px; transition:0.2s; }
.btn-back:hover { background: var(--btn-back-hover); }
.scroll-area { flex: 1; overflow-y: auto; padding: 30px; }
.list-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; max-width: 1200px; margin: 0 auto; }
.list-item { background: var(--list-bg); border: 1px solid var(--border); padding: 20px; border-radius: 12px; cursor: pointer; transition: 0.2s; }
.list-item:hover { border-color: var(--primary); transform: translateY(-5px); background: var(--list-bg-hover); }








.input-container { flex: 1; display: flex; flex-direction: column; gap: 5px; }
#msg-input { margin: 0; width: 100%; border-radius: 20px; background: var(--msg-input-bg); border: 1px solid var(--msg-input-border); color: var(--msg-input-text); padding: 12px 18px; font-size: 15px; transition: all 0.3s ease; }
#msg-input::placeholder { color: var(--msg-input-placeholder); }
#msg-input:focus { background: var(--msg-input-focus-bg); border-color: var(--primary); box-shadow: 0 0 15px rgba(0, 242, 255, 0.3); transform: translateY(-1px); }
#admin-overlay { display: none; position: fixed; inset: 0; background: var(--overlay-bg); z-index: 200; overflow-y: auto; padding: 30px; }
.admin-h { display: flex; justify-content: space-between; margin-bottom: 30px; border-bottom: 1px solid var(--admin-h-border); padding-bottom: 20px; }
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 30px; }
.stat-item { background: var(--stat-bg); border: 1px solid var(--stat-border); padding: 25px; border-radius: 12px; text-align: center; cursor: pointer; transition: 0.2s; }
.stat-item:hover { border-color: var(--primary); background: var(--stat-bg-hover); }
.data-panel { background: var(--data-panel-bg); padding: 20px; border-radius: 12px; border: 1px solid var(--data-panel-border); min-height: 400px; display: flex; flex-direction: column; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; color: var(--table-text); }
.data-table th { text-align: left; padding: 15px; border-bottom: 1px solid var(--table-th-border); color: var(--table-th-text); }
.data-table td { padding: 12px 15px; border-bottom: 1px solid var(--table-td-border); }
.btn-act { padding: 4px 10px; border-radius: 4px; border: none; cursor: pointer; font-size: 12px; margin-right: 5px; font-weight: bold; }
.btn-edit { background: var(--primary); color: #000; } .btn-del { background: var(--error); color: #fff; }
.pagination { display: flex; justify-content: flex-end; padding: 10px 0; align-items: center; gap: 15px; margin-top: 10px; border-top: 1px solid var(--stat-border); pt-2; }
.btn-page { background: var(--btn-page-bg); border: 1px solid var(--btn-page-border); color: var(--btn-page-text); padding: 6px 15px; border-radius: 6px; cursor: pointer; font-size: 13px; transition: 0.2s; }
.btn-page:hover:not(:disabled) { background: var(--primary); color: #000; border-color: var(--primary); }
.btn-page:disabled { opacity: 0.5; cursor: not-allowed; }
.page-info { font-size: 13px; color: var(--text-muted); font-family: monospace; }
#sys-modal, #leaderboard-modal { display: none; position: fixed; inset: 0; z-index: 2000; background: var(--modal-overlay-bg); justify-content: center; align-items: center; }
#edit-modal, #admin-level-modal, #admin-progress-modal { display: none; position: fixed; inset: 0; z-index: 1000; background: var(--modal-overlay-bg-heavy); justify-content: center; align-items: center; }
#detail-modal { display: none; position: fixed; inset: 0; z-index: 1500; background: var(--modal-overlay-bg); justify-content: center; align-items: center; }
.m-content { background: var(--m-content-bg); padding: 30px; border-radius: 16px; width: 320px; text-align: center; border: 1px solid var(--m-content-border); box-shadow: 0 20px 50px var(--m-content-shadow); }
.detail-content { width: 600px; max-width: 95%; height: 80vh; display: flex; flex-direction: column; text-align: left; }
.m-btns { display: flex; gap: 10px; margin-top: 25px; }
.btn-k { flex: 1; padding: 10px; border-radius: 8px; border: none; cursor: pointer; font-weight: bold; }
.edit-form label { display: block; text-align: left; color: var(--text-muted); font-size: 12px; margin-bottom: 5px; }
.edit-form input { width: 100%; padding: 10px; margin-bottom: 15px; background: var(--edit-input-bg); border: 1px solid var(--edit-input-border); color: var(--edit-input-text); border-radius: 6px; }
.level-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; max-height: 400px; overflow-y: auto; padding: 10px; margin-bottom: 20px; }
.level-btn { background: var(--level-btn-bg); border: 1px solid var(--border); color: var(--text-primary); padding: 10px 0; border-radius: 8px; cursor: pointer; font-weight: bold; transition: 0.2s; font-size: 14px; }
.level-btn:hover { background: var(--primary); color: #000; transform: scale(1.05); }
.level-btn.unlocked { border-color: var(--level-btn-unlocked-border); background: var(--level-btn-unlocked-bg); }
.level-btn.locked { opacity: 0.3; cursor: not-allowed; }
.timeline { padding: 10px; overflow-y: auto; flex: 1; }
.timeline-item { border-left: 2px solid var(--timeline-border); padding-left: 20px; margin-bottom: 20px; position: relative; }
.timeline-item::before { content: ''; position: absolute; left: -6px; top: 0; width: 10px; height: 10px; background: var(--primary); border-radius: 50%; box-shadow: 0 0 10px var(--primary); }
.t-date { font-size: 12px; color: var(--text-muted); margin-bottom: 5px; font-family: monospace; }
.t-content { background: var(--t-content-bg); padding: 10px; border-radius: 8px; font-size: 14px; color: var(--t-content-text); border: 1px solid var(--t-content-border); }
.t-tag { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 11px; margin-right: 8px; font-weight: bold; }
.tag-login { background: rgba(0, 100, 255, 0.2); color: #4facfe; } .tag-challenge { background: rgba(0, 200, 83, 0.2); color: #00c853; } .tag-post { background: rgba(255, 150, 0, 0.2); color: #ff9800; }
#task-toast { position: absolute; top: 80px; left: 50%; transform: translateX(-50%); background: var(--toast-bg); color: var(--toast-text); padding: 10px 24px; border-radius: 40px; font-size: 0.95rem; pointer-events: none; opacity: 0; transition: opacity 0.3s; z-index: 200; font-weight: 700; box-shadow: 0 10px 40px var(--toast-shadow); white-space: nowrap; }
.toast-visible { opacity: 1 !important; transform: translateX(-50%) translateY(0) !important; }
.level-map-container { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 900px; margin: 20px auto 30px; }
.map-cell { aspect-ratio: 1; background: var(--map-cell-bg); border: 1px solid var(--map-cell-border); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--map-cell-text); font-weight: bold; transition: all 0.3s; cursor: default; }
.map-cell.done { background: var(--primary); color: #000; border-color: var(--primary); box-shadow: 0 0 10px var(--primary-glow); }

.highlight-row td { color: var(--warning) !important; font-weight: bold; }
.progress-content { width: 95%; height: 90vh; background: var(--progress-bg); border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; }
.progress-grid { display: grid; grid-template-columns: 200px repeat(115, 32px); overflow: auto; height: 100%; position: relative; }
.progress-header { position: sticky; top: 0; z-index: 2; background: var(--progress-header-bg); color: var(--text-muted); font-size: 12px; font-weight: bold; text-align: center; border-bottom: 1px solid var(--stat-border); line-height: 40px; }
.user-cell { position: sticky; left: 0; z-index: 1; background: var(--user-cell-bg); border-right: 1px solid var(--stat-border); border-bottom: 1px solid var(--stat-border); padding: 0 10px; display: flex; align-items: center; font-size: 12px; color: var(--table-text); height: 40px; }
.p-cell { border-right: 1px solid var(--p-cell-border); border-bottom: 1px solid var(--p-cell-border); background: var(--p-cell-bg); height: 40px; display:flex; align-items:center; justify-content:center; font-size:10px; color:#000; font-weight:bold; }
.p-cell.type-1 { background: var(--success); } .p-cell.type-2 { background: var(--primary); } .p-cell.type-3 { background: #d63031; color: #fff; }
.legend-box { display:flex; gap:15px; align-items:center; margin-right:20px; }
.legend-item { display:flex; align-items:center; gap:5px; font-size:12px; color:var(--table-text); }
.legend-dot { width:12px; height:12px; border-radius:3px; }

.leaderboard-list { width: 100%; text-align: left; }
.lb-item { display: flex; justify-content: space-between; padding: 12px; border-bottom: 1px dashed var(--lb-item-border); font-size: 14px; align-items: center; }
.lb-rank { width: 30px; font-weight: bold; color: var(--primary); font-size: 16px; font-style: italic; }
.lb-name { flex: 1; color: var(--lb-name-color); }
.lb-score { color: #ff9f43; font-weight: bold; }
.lb-myself { background: rgba(0, 242, 255, 0.1); border-radius: 8px; border: 1px solid var(--primary); margin-top: 10px; }

/* ========================================
   Forum - Redesigned Standard Forum UI
   ======================================== */

/* Forum Header Title */
.forum-header-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin-left: 12px;
    letter-spacing: 0.5px;
}

/* Forum Container */
.forum-box {
    max-width: 800px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--forum-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
}

/* Stats Bar */
.forum-stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.15);
    font-size: 13px;
    color: #888;
}
.forum-refresh-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    color: #aaa;
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.forum-refresh-btn:hover {
    background: rgba(0,242,255,0.1);
    border-color: var(--primary);
    color: var(--primary);
}

/* Message List */
.msgs {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    scroll-behavior: smooth;
}

/* Post Card */
.forum-post-card {
    display: flex;
    gap: 14px;
    padding: 16px;
    margin-bottom: 12px;
    background: rgba(0,0,0,0.25);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.06);
    transition: all 0.2s ease;
    position: relative;
}
.forum-post-card:hover {
    background: rgba(0,242,255,0.03);
    border-color: rgba(0,242,255,0.1);
}

/* Avatar */
.forum-post-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Post Body */
.forum-post-body {
    flex: 1;
    min-width: 0;
}

/* Post Header */
.forum-post-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.forum-post-author {
    font-weight: 600;
    font-size: 14px;
    color: var(--primary);
}
.forum-post-time {
    font-size: 12px;
    color: #666;
}
.forum-post-del {
    margin-left: auto;
    background: none;
    border: none;
    color: #555;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.15s;
    opacity: 0;
}
.forum-post-card:hover .forum-post-del {
    opacity: 1;
}
.forum-post-del:hover {
    color: #ff4444;
    background: rgba(255,68,68,0.1);
}

/* Post Content */
.forum-post-content {
    color: #ddd;
    font-size: 14px;
    line-height: 1.7;
    word-break: break-word;
    white-space: pre-wrap;
}

/* Post Image */
.forum-post-image {
    margin-top: 10px;
    border-radius: 10px;
    overflow: hidden;
    display: inline-block;
    max-width: 320px;
    cursor: pointer;
    transition: transform 0.2s;
}
.forum-post-image:hover {
    transform: scale(1.02);
}
.forum-post-image img {
    max-width: 100%;
    max-height: 240px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    display: block;
}

/* Empty State */
.forum-empty {
    text-align: center;
    padding: 60px 20px;
    color: #555;
}
.forum-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}
.forum-empty-text {
    font-size: 15px;
    color: #666;
}

/* Input Area */
.forum-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: var(--input-box-bg);
}
.forum-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}
.forum-attach-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    color: #aaa;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.forum-attach-btn:hover {
    background: rgba(0,242,255,0.1);
    border-color: var(--primary);
    color: var(--primary);
}
.forum-input {
    flex: 1;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.06);
    color: #fff;
    padding: 0 14px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}
.forum-input:focus {
    border-color: var(--primary);
    background: rgba(255,255,255,0.1);
    box-shadow: 0 0 0 3px rgba(0,242,255,0.1);
}
.forum-input::placeholder {
    color: rgba(255,255,255,0.3);
}
.forum-send-btn {
    height: 40px;
    padding: 0 20px;
    border-radius: 10px;
    border: none;
    background: var(--primary);
    color: #000;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.forum-send-btn:hover {
    background: #33f5ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,242,255,0.3);
}
.forum-send-btn:active {
    transform: translateY(0);
}

/* Image Preview */
.forum-img-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(0,242,255,0.05);
    border-radius: 8px;
    border: 1px dashed rgba(0,242,255,0.2);
}
.forum-img-label {
    font-size: 12px;
    color: var(--primary);
}
.forum-img-remove {
    background: none;
    border: none;
    color: #ff4444;
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
}


/* ========================================
   Notification Panel
   ======================================== */
#notif-panel::-webkit-scrollbar { width: 4px; }
#notif-panel::-webkit-scrollbar-thumb { background: rgba(0,242,255,0.2); border-radius: 2px; }

/* ========================================
   Private Messaging
   ======================================== */
#pm-chat-list::-webkit-scrollbar { width: 4px; }
#pm-chat-list::-webkit-scrollbar-thumb { background: rgba(0,242,255,0.2); border-radius: 2px; }
#pm-msg-list::-webkit-scrollbar { width: 4px; }
#pm-msg-list::-webkit-scrollbar-thumb { background: rgba(0,242,255,0.2); border-radius: 2px; }

/* Mention dropdown */
#mention-dropdown::-webkit-scrollbar { width: 4px; }
#mention-dropdown::-webkit-scrollbar-thumb { background: rgba(0,242,255,0.2); border-radius: 2px; }
.mention-item:first-child { border-radius: 10px 10px 0 0; }
.mention-item:last-child { border-radius: 0 0 10px 10px; }

/* PM chat list mobile */
@media (max-width: 768px) {
    #pm-chat-list { width: 100% !important; border-right: none !important; border-bottom: 1px solid var(--border); max-height: 200px; }
    .forum-box { flex-direction: column !important; }
    #notif-panel { width: calc(100vw - 20px) !important; right: 10px !important; left: 10px !important; }
}

/* Mention highlight in posts */
.forum-post-content span[style*="color:var(--primary)"]:hover {
    text-decoration: underline;
}
@media (max-width: 768px) { .menu-grid { grid-template-columns: 1fr; gap: 20px; max-width: 400px; } .hero-title { font-size: 28px; letter-spacing: 1px; } .hero-subtitle { font-size: 12px; letter-spacing: 2px; } #menu-view { padding-top: 140px; padding-bottom: 120px; justify-content: flex-start; } .app-footer { font-size: 11px; padding: 20px 15px 60px 15px; } .stat-cards { grid-template-columns: 1fr 1fr; } .list-grid { grid-template-columns: repeat(2, 1fr); } .level-grid { grid-template-columns: repeat(4, 1fr); } .auth-card { width: 90%; padding: 40px 20px; } .brand-title { font-size: 34px; background: none; -webkit-text-fill-color: var(--text-primary); color: var(--text-primary); text-shadow: 0 0 15px var(--primary); } .brand-title span { color: var(--primary); -webkit-text-fill-color: var(--primary); } .welcome-text { font-size: 12px; letter-spacing: 0; white-space: nowrap; margin-bottom: 30px; } .hero-stats { flex-direction: column; gap: 5px; padding: 15px 25px; border-radius: 20px; } .hero-stats .divider { display: none; } .level-map-container { max-width: 100%; } }
/* 按钮脉冲动画 */
@keyframes pulse { 0% { transform: scale(1); box-shadow: 0 0 15px rgba(255, 215, 0, 0.6); } 50% { transform: scale(1.05); box-shadow: 0 0 25px rgba(255, 215, 0, 1); } 100% { transform: scale(1); box-shadow: 0 0 15px rgba(255, 215, 0, 0.6); } }

/* 【新增】证书预览弹窗样式 */
#cert-preview-overlay {
    position: fixed; inset: 0; background: var(--cert-overlay-bg); z-index: 5000;
    display: none; flex-direction: column; align-items: center; justify-content: center; padding: 20px;
}
#cert-img-container {
    width: 100%; max-width: 900px;
    background: #fff; border-radius: 8px; overflow: hidden;
    box-shadow: 0 0 60px var(--shadow-heavy);
    border: 1px solid var(--cert-border);
}
#cert-img-container img { width: 100%; height: auto; display: block; }
.btn-cert-close { margin-top: 24px; padding: 10px 30px; background: var(--cert-close-bg); color: var(--cert-close-text); border-radius: 30px; border: 1px solid var(--cert-close-border); cursor: pointer; transition: all 0.2s; font-size: 14px; font-weight: bold; }
.btn-cert-close:hover { background: var(--cert-close-hover); }

/* 【新增】闯关大厅积分仪表盘样式 */
.chal-hud {
    display: flex; gap: 20px; margin-bottom: 20px;
    background: var(--chal-hud-bg); border: 1px solid var(--chal-hud-border);
    padding: 10px 30px; border-radius: 12px; backdrop-filter: blur(10px);
}
.chal-stat-item {
    display: flex; flex-direction: column; align-items: center;
}
.cs-label { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; text-transform: uppercase; letter-spacing: 1px; }
.cs-val { font-size: 20px; font-weight: 800; color: var(--cs-val-color); }
#c-rank { color: var(--primary); text-shadow: 0 0 10px rgba(0, 242, 255, 0.3); }
#c-score { color: #ff9f43; text-shadow: 0 0 10px rgba(255, 159, 67, 0.3); }

/* ============================================
   响应式适配 - 增补
   平板 (768px - 1024px) + 手机增强 + 触控优化
   ============================================ */


/* === 桌面中等屏幕 (769px - 1400px) - 处理屏幕缩放 === */
@media (min-width: 769px) and (max-width: 1400px) {
    .hero-title { font-size: 38px; letter-spacing: 1px; }
    .hero-subtitle { font-size: 14px; letter-spacing: 3px; }
    .hero-section { margin-top: 1vh; margin-bottom: 30px; }
    .menu-grid { gap: 20px; }
    .menu-card { padding: 35px 18px; }
    .menu-icon { font-size: 42px; margin-bottom: 15px; }
    .navbar { padding: 0 20px; gap: 8px; }
    .navbar > div:last-child { gap: 10px; flex-wrap: wrap; }
    .chal-hud { gap: 15px; padding: 10px 20px; }
    .level-map-container { max-width: 500px; }
}

/* === 桌面高DPI缩放/窗口高度不足适配 === */
@media (min-width: 769px) and (max-height: 700px) {
    .hero-section { margin-top: 0; margin-bottom: 15px; }
    .hero-title { font-size: 30px; }
    .hero-subtitle { font-size: 12px; margin-top: 5px; }
    .hero-stats { margin-top: 10px; padding: 6px 18px; font-size: 12px; }
    .menu-grid { gap: 15px; }
    .menu-card { padding: 25px 15px; }
    .menu-icon { font-size: 36px; margin-bottom: 10px; }
    .app-footer { padding: 10px; margin-top: 10px; }
}


/* ===== 闯关模式 V2：高端游戏化面板 ===== */

/* ===== 闯关模式：沉浸式剧情地图 (Story Map) ===== */

/* 覆盖旧容器宽度限制，适配故事卡片（#level-map 具更高优先级） */
#level-map.level-map-container { max-width: 880px; }

/* 故事地图容器 */
.story-map {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    padding: 4px 0 10px;
}

/* 章节故事卡片 */
.story-chapter-card {
    position: relative;
    background: var(--glass);
    border: 1px solid rgba(255,255,255,0.08);
    border-left: 3px solid var(--ch-color, var(--primary));
    border-radius: 14px;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    backdrop-filter: blur(6px);
}
.story-chapter-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.4);
    border-color: rgba(255,255,255,0.14);
    border-left-color: var(--ch-color, var(--primary));
}

/* 卡片头部 */
.story-chapter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 10px;
    background: var(--ch-bg, rgba(0,242,255,0.04));
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.story-chapter-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.story-ch-icon {
    font-size: 26px;
    line-height: 1;
    flex-shrink: 0;
    filter: drop-shadow(0 0 8px var(--ch-color, var(--primary)));
}
.story-ch-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ch-color, var(--primary));
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.story-ch-title .story-ch-num {
    font-size: 12px;
    opacity: 0.7;
    margin-right: 4px;
}
.story-chapter-progress {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
    flex-shrink: 0;
    padding-left: 10px;
}
.story-chapter-progress .done-count {
    color: #00e676;
    font-weight: 700;
}
.story-chapter-progress.all-done {
    color: #00e676;
}
.story-chapter-progress.not-started {
    opacity: 0.4;
}

/* 章节引言 */
.story-chapter-intro {
    padding: 10px 18px 8px;
    font-size: 12px;
    line-height: 1.6;
    color: rgba(255,255,255,0.45);
    font-style: italic;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.story-chapter-intro::before {
    content: '\201C';
    font-size: 28px;
    color: var(--ch-color, var(--primary));
    opacity: 0.4;
    vertical-align: -8px;
    margin-right: 4px;
    font-style: normal;
    line-height: 0;
}

/* 角色头像行 */
.story-characters {
    display: flex;
    gap: 14px;
    padding: 8px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    flex-wrap: wrap;
}
.story-char-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}
.story-char-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

/* 关卡路径区域 */
.story-level-path {
    padding: 14px 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.story-level-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
    margin-bottom: -6px;
    padding-left: 2px;
}

/* 关卡节点行（横向滚动，保持路径连续） */
.story-level-row {
    display: flex;
    align-items: flex-start;
    row-gap: 16px;
    gap: 0;
    flex-wrap: wrap;/* 自动换行：显示所有关卡 */ 
    /* overflow-x: auto; -- removed for wrap mode */ 
    /* overflow-y: hidden; -- removed for wrap mode */ 
    padding-bottom: 4px;
    /* -webkit-overflow-scrolling: touch; -- removed for wrap mode */ 
    /* scroll-snap-type: x proximity; -- removed for wrap mode */ 
}
.story-level-row::-webkit-scrollbar { height: 3px; }
.story-level-row::-webkit-scrollbar-track { background: transparent; }
.story-level-row::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* 单个关卡节点 */
.story-level-node {
    position: relative;
    flex: 0 0 auto;
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 2px;
    /* scroll-snap-align removed */
    transition: transform 0.2s ease;
}

/* 节点间连接线（水平路径） */
.story-level-node:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 27px;
    left: calc(50% + 23px);
    width: calc(100% - 46px);
    height: 2px;
    background: rgba(255,255,255,0.08);
    z-index: 0;
    border-radius: 1px;
}
.story-level-node.done:not(:last-child)::after {
    background: linear-gradient(90deg, rgba(0,230,118,0.4), rgba(0,230,118,0.12));
}
.story-level-node.unlocked:not(:last-child)::after {
    background: linear-gradient(90deg, rgba(0,242,255,0.3), rgba(255,255,255,0.08));
}

/* 圆形节点徽章 */
.story-node-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    transition: all 0.25s ease;
    border: 2px solid;
}

/* 已完成：绿色发光 */
.story-node-circle.done {
    background: linear-gradient(135deg, rgba(0,230,118,0.3), rgba(0,230,118,0.1));
    border-color: rgba(0,230,118,0.6);
    color: #00e676;
    box-shadow: 0 0 14px rgba(0,230,118,0.25);
}
.story-level-node.done:hover .story-node-circle {
    box-shadow: 0 0 22px rgba(0,230,118,0.45);
    transform: scale(1.1);
}

/* 可挑战：青色脉冲 */
.story-node-circle.unlocked {
    background: linear-gradient(135deg, rgba(0,242,255,0.25), rgba(0,242,255,0.06));
    border-color: rgba(0,242,255,0.5);
    color: #00f2ff;
    animation: storyPulse 2.5s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(0,242,255,0.2);
}
@keyframes storyPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(0,242,255,0.15); }
    50% { box-shadow: 0 0 22px rgba(0,242,255,0.35); }
}
.story-level-node.unlocked:hover .story-node-circle {
    transform: scale(1.12);
    box-shadow: 0 0 26px rgba(0,242,255,0.5);
}

/* 锁定：暗灰 */
.story-node-circle.locked {
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.2);
    font-size: 13px;
}

/* 节点标签 */
.story-node-label {
    margin-top: 6px;
    text-align: center;
    width: 100%;
    z-index: 1;
}
.story-node-num {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 1px;
}
.story-level-node.done .story-node-num { color: #00e676; }
.story-level-node.unlocked .story-node-num { color: #00f2ff; }
.story-level-node.locked .story-node-num { color: rgba(255,255,255,0.25); }

.story-node-title {
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    line-height: 1.3;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.story-level-node.locked .story-node-title {
    color: rgba(255,255,255,0.2);
}
.story-node-badge {
    display: inline-block;
    font-size: 8px;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(255,107,53,0.15);
    color: #ff6b35;
    font-weight: 700;
    margin-top: 2px;
}

/* 交互态 */
.story-level-node.done,
.story-level-node.unlocked {
    cursor: pointer;
}
.story-level-node.done:hover,
.story-level-node.unlocked:hover {
    transform: translateY(-2px);
}

/* === Story Map 响应式 === */

/* 平板 (768px - 1199px) */
@media (max-width: 1199px) {
    .story-map { max-width: 100%; }
    .story-level-node { width: 68px; }
    .story-node-circle { width: 38px; height: 38px; font-size: 14px; }
    .story-level-node:not(:last-child)::after {
        top: 24px;
        left: calc(50% + 20px);
        width: calc(100% - 40px);
    }
}

/* 手机 (< 768px) */
@media (max-width: 768px) {
    .story-map { gap: 12px; padding: 2px 0; }
    .story-chapter-header { padding: 10px 14px 8px; }
    .story-ch-icon { font-size: 22px; }
    .story-ch-title { font-size: 13px; }
    .story-ch-title .story-ch-num { font-size: 11px; }
    .story-chapter-progress { font-size: 11px; }
    .story-chapter-intro { padding: 8px 14px 6px; font-size: 11px; }
    .story-characters { padding: 6px 14px; gap: 10px; }
    .story-char-avatar { width: 24px; height: 24px; font-size: 14px; }
    .story-char-item { font-size: 10px; }
    .story-level-path { padding: 10px 14px 12px; gap: 10px; }
    .story-level-section-label { font-size: 9px; }
    .story-level-node { width: 58px; padding: 4px 2px; }
    .story-node-circle { width: 34px; height: 34px; font-size: 12px; }
    .story-node-num { font-size: 9px; }
    .story-node-title { font-size: 10px; }
    .story-level-node:not(:last-child)::after {
        top: 20px;
        left: calc(50% + 18px);
        width: calc(100% - 36px);
    }
}

/* 极小屏幕 (< 380px) */
@media (max-width: 380px) {
    .story-level-node { width: 52px; }
    .story-node-circle { width: 30px; height: 30px; font-size: 11px; }
    .story-level-node:not(:last-child)::after {
        top: 18px;
        left: calc(50% + 16px);
        width: calc(100% - 32px);
    }
}

/* 减少动画模式 */
@media (prefers-reduced-motion: reduce) {
    .story-node-circle.unlocked { animation: none; }
    .story-chapter-card { transition: none; }
}

/* === 自由探索：手风琴折叠 === */
.free-accordion {
    margin-bottom: 10px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--glass);
    border: 1px solid rgba(255,255,255,0.06);
    transition: border-color 0.3s ease;
}
.free-accordion:has(.free-accordion-body.open) {
    border-color: rgba(255,255,255,0.12);
}

.free-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    cursor: pointer;
    transition: background 0.2s ease;
    user-select: none;
}
.free-accordion-header:hover {
    background: rgba(255,255,255,0.03);
}
.free-accordion-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.free-accordion-icon {
    font-size: 24px;
    line-height: 1;
}
.free-accordion-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ch-color, var(--primary));
    letter-spacing: 0.3px;
}
.free-accordion-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.free-accordion-count {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.05);
    padding: 2px 10px;
    border-radius: 10px;
}
.free-accordion-arrow {
    font-size: 14px;
    color: rgba(255,255,255,0.5);
    transition: transform 0.3s ease;
}

.free-accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 18px;
}
.free-accordion-body.open {
    padding-bottom: 16px;
}

.free-accordion-body .free-grid {
    margin-top: 10px;
}

/* 手风琴响应式 */
@media (max-width: 768px) {
    .free-accordion-header { padding: 12px 14px; }
    .free-accordion-icon { font-size: 20px; }
    .free-accordion-title { font-size: 14px; }
    .free-accordion-body { padding: 0 14px; }
    .free-accordion-body.open { padding-bottom: 12px; }
}

/* keep old map-cell for backward compatibility (forum, admin views) */


/* === 平板适配 (768px - 1024px) === */
@media (min-width: 769px) and (max-width: 1024px) {
    .menu-grid { grid-template-columns: repeat(2, 1fr); gap: 24px; max-width: 700px; }
    .hero-title { font-size: 36px; }
    .hero-subtitle { font-size: 14px; letter-spacing: 3px; }
    .menu-card { padding: 40px 20px; }
    .menu-icon { font-size: 42px; }
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .list-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
    .level-grid { grid-template-columns: repeat(5, 1fr); }
    .level-map-container { max-width: 700px; }
    .navbar { padding: 0 20px; }
    .btn-back { padding: 10px 20px; font-size: 14px; }
    
    .data-table th, .data-table td { padding: 10px 12px; font-size: 13px; }
    .progress-grid { grid-template-columns: 150px repeat(115, 28px); }
    .m-content { width: 350px; }
    .detail-content { width: 90%; }
    .chal-hud { gap: 15px; padding: 10px 20px; flex-wrap: wrap; }
}

/* === 手机增强适配 (< 768px) - 补充已有规则 === */
@media (max-width: 768px) {
    /* 导航栏触控优化 */
    .navbar { height: 56px; padding: 0 15px; }
    .navbar a, .navbar button, .navbar span[onclick] { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }

    /* body 允许滚动（移动端需要） */
    body { overflow-y: auto; overflow-x: hidden; }

    /* 主内容区 */
    .main-content { overflow-y: auto; }

    /* 子视图 */
    .sub-header { padding: 12px 15px; }
    .scroll-area { padding: 15px; }
    .list-item { padding: 15px; border-radius: 10px; }

    /* 论坛适配 */
    
    
    
    
    #msg-input { padding: 10px 15px; font-size: 14px; border-radius: 25px; }

    /* 弹窗全屏化 */
    .m-content { width: 90%; max-width: 320px; padding: 25px 20px; border-radius: 16px; }
    .detail-content { width: 100%; height: 100vh; max-width: 100%; border-radius: 0; }

    /* 排行榜弹窗 */
    #leaderboard-modal .m-content, #sys-modal .m-content { width: 92%; }
    .lb-item { padding: 10px 8px; font-size: 13px; }

    /* 管理面板适配 */
    #admin-overlay { padding: 15px; }
    .stat-item { padding: 15px; }
    .data-panel { min-height: auto; }
    .data-table { font-size: 12px; display: block; overflow-x: auto; white-space: nowrap; }
    .data-table th, .data-table td { padding: 8px 10px; }
    .pagination { flex-wrap: wrap; justify-content: center; gap: 10px; }

    /* 关卡地图 */
    .map-cell { font-size: 10px; }

    /* 闯关大厅HUD */
    .chal-hud { flex-direction: column; gap: 8px; padding: 10px 15px; align-items: flex-start; }
    .chal-stat-item { flex-direction: row; gap: 8px; align-items: center; }
    .cs-val { font-size: 16px; }

    /* 进度总览表格 */
    .progress-content { width: 100%; height: 95vh; border-radius: 8px; }
    .progress-grid { grid-template-columns: 120px repeat(115, 24px); }
    .progress-header { font-size: 10px; line-height: 32px; }
    .user-cell { font-size: 11px; height: 32px; }
    .p-cell { height: 32px; font-size: 9px; }

    /* 证书弹窗 */
    #cert-preview-overlay { padding: 10px; }
    #cert-img-container { max-width: 100%; border-radius: 4px; }

    /* 触控友好按钮 */
    .btn-main { padding: 18px; font-size: 17px; }
    .btn-back { padding: 10px 18px; min-height: 44px; }
    .btn-act { padding: 6px 14px; font-size: 13px; min-height: 36px; }
    .btn-page { padding: 8px 18px; min-height: 40px; }
    .switch-link { padding: 10px 0; font-size: 14px; }
}

/* === 极小屏幕 (< 380px) === */
@media (max-width: 380px) {
    .auth-card { padding: 30px 15px; }
    .brand-title { font-size: 28px; }
    .hero-title { font-size: 24px; }
    .menu-card { padding: 30px 10px; }
    .list-grid { grid-template-columns: 1fr; }
    .level-grid { grid-template-columns: repeat(3, 1fr); }
    .level-map-container { max-width: 100%; }
    .stat-cards { grid-template-columns: 1fr; }

    .chapter-tab { padding: 6px 10px; font-size: 10px; border-radius: 16px; }
    .chapter-tab .ch-name { font-size: 10px; }
    .chapter-tab .ch-progress { font-size: 9px; padding: 1px 5px; }
    .ch-map-cell { width: 85px; min-height: 58px; padding: 5px 3px; }
    .ch-map-cell .cell-title { font-size: 10px; }
    .chapter-grid-header { font-size: 15px; }
}

/* === 横屏手机 === */
@media (max-height: 500px) and (orientation: landscape) {
    .navbar { height: 48px; }
    #menu-view { padding-top: 60px; padding-bottom: 60px; }
    .hero-section { margin-top: 0; margin-bottom: 20px; }
    .hero-title { font-size: 24px; }
    .menu-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
    .menu-card { padding: 25px 15px; }
    .menu-icon { font-size: 30px; margin-bottom: 10px; }
}

/* === 安全区域 (iPhone 刘海屏适配) === */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .navbar { padding-top: env(safe-area-inset-top); }
    
    .app-footer { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}

/* === 触控设备交互优化 === */
@media (hover: none) and (pointer: coarse) {
    .menu-card:hover { transform: none; box-shadow: none; }
    .list-item:hover { transform: none; }
    .menu-card:active { transform: scale(0.97); transition: transform 0.1s; }
    .list-item:active { transform: scale(0.98); background: rgba(0,242,255,0.08); }
    .btn-main:hover { transform: none; filter: none; }
    .btn-main:active { transform: scale(0.97); }
}

/* ============================================
   批次2优化：移动端私聊全屏导航 + 论坛输入框适配
   ============================================ */

/* === 移动端私聊全屏导航 === */
@media (max-width: 768px) {
    /* 私聊视图改为垂直堆叠 */
    #view-messages .forum-box {
        flex-direction: column !important;
        height: 100% !important;
    }
    
    /* 隐藏聊天列表侧边栏 */
    #pm-chat-list {
        width: 100% !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border);
        max-height: 45vh !important;
        min-height: 200px !important;
    }
    
    /* 聊天列表项移动端适配 */
    #pm-chat-list .chat-item {
        padding: 14px 16px !important;
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        cursor: pointer;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        transition: background 0.15s;
    }
    
    #pm-chat-list .chat-item:active {
        background: rgba(0, 242, 255, 0.1);
    }
    
    #pm-chat-list .chat-item .avatar {
        width: 44px !important;
        height: 44px !important;
        font-size: 18px !important;
        flex-shrink: 0;
    }
    
    #pm-chat-list .chat-item .info {
        flex: 1;
        min-width: 0;
    }
    
    #pm-chat-list .chat-item .name {
        font-weight: 600;
        color: var(--primary);
        font-size: 15px;
    }
    
    #pm-chat-list .chat-item .preview {
        font-size: 13px;
        color: #888;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    #pm-chat-list .chat-item .badge {
        background: var(--primary);
        color: #000;
        font-size: 11px;
        padding: 2px 8px;
        border-radius: 10px;
        font-weight: bold;
    }
    
    /* 聊天区域全屏显示 */
    #pm-chat-area {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: var(--bg-deep) !important;
        z-index: 100 !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* 隐藏空状态提示 */
    #pm-empty-state {
        display: none !important;
    }
    
    /* 聊天视图头部 - 移动端全屏模式 */
    #pm-chat-view {
        display: flex !important;
        flex: 1 !important;
        flex-direction: column !important;
        height: 100% !important;
    }
    
    /* 聊天头部带返回按钮 */
    #pm-chat-header {
        padding: 10px 12px !important;
        min-height: 50px !important;
        background: rgba(10, 12, 18, 0.95) !important;
        border-bottom: 1px solid var(--border) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        backdrop-filter: blur(10px) !important;
    }
    
    /* 返回按钮 */
    .pm-back-btn {
        width: 36px !important;
        height: 36px !important;
        border-radius: 50% !important;
        background: rgba(255, 255, 255, 0.1) !important;
        border: none !important;
        color: var(--primary) !important;
        font-size: 18px !important;
        cursor: pointer !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin-right: 10px !important;
        flex-shrink: 0 !important;
    }
    
    /* 消息列表 */
    #pm-msg-list {
        flex: 1 !important;
        padding: 12px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* 消息输入区域 */
    #pm-chat-view > div:last-child {
        padding: 10px 12px !important;
        padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important;
        background: rgba(10, 12, 18, 0.95) !important;
        border-top: 1px solid var(--border) !important;
        display: flex !important;
        gap: 10px !important;
        align-items: flex-end !important;
        -webkit-backdrop-filter: blur(10px) !important;
        backdrop-filter: blur(10px) !important;
    }
    
    #pm-chat-view > div:last-child input {
        flex: 1 !important;
        min-height: 40px !important;
        max-height: 120px !important;
        border-radius: 20px !important;
        padding: 10px 16px !important;
        font-size: 15px !important;
    }
    
    #pm-chat-view > div:last-child button {
        width: 44px !important;
        height: 44px !important;
        border-radius: 50% !important;
        flex-shrink: 0 !important;
    }
    
    /* 私聊消息气泡 */
    .pm-msg {
        max-width: 80%;
        margin-bottom: 10px;
        clear: both;
    }
    
    .pm-msg.sent {
        float: right;
    }
    
    .pm-msg.received {
        float: left;
    }
    
    .pm-msg .bubble {
        padding: 10px 14px;
        border-radius: 16px;
        font-size: 14px;
        line-height: 1.4;
        word-break: break-word;
    }
    
    .pm-msg.sent .bubble {
        background: var(--primary);
        color: #000;
        border-bottom-right-radius: 4px;
    }
    
    .pm-msg.received .bubble {
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
        border-bottom-left-radius: 4px;
    }
    
    .pm-msg .time {
        font-size: 10px;
        color: #666;
        margin-top: 4px;
        text-align: right;
    }
    
    .pm-msg.received .time {
        text-align: left;
    }
}

/* === 论坛输入框移动端适配 === */
@media (max-width: 768px) {
    /* 输入区域固定在底部 */
    .forum-input-area {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        padding: 10px 12px !important;
        padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important;
        background: rgba(10, 12, 18, 0.98) !important;
        border-top: 1px solid var(--border) !important;
        z-index: 500 !important;
        -webkit-backdrop-filter: blur(10px) !important;
        backdrop-filter: blur(10px) !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3) !important;
    }
    
    /* 论坛视图底部留白 */
    #view-forum {
        padding-bottom: 70px !important;
    }
    
    #view-forum .forum-box {
        height: calc(100% - 60px) !important;
    }
    
    /* 论坛输入框样式优化 */
    .forum-input-area .forum-input-row {
        display: flex !important;
        gap: 8px !important;
        align-items: center !important;
    }
    
    .forum-input-area .forum-attach-btn {
        width: 40px !important;
        height: 40px !important;
        flex-shrink: 0 !important;
    }
    
    .forum-input-area .forum-input {
        flex: 1 !important;
        height: 40px !important;
        font-size: 15px !important;
    }
    
    .forum-input-area .forum-send-btn {
        height: 40px !important;
        padding: 0 16px !important;
        font-size: 14px !important;
        flex-shrink: 0 !important;
    }
    
    /* @提及下拉框改为底部弹出样式 */
    #mention-dropdown {
        position: fixed !important;
        bottom: calc(60px + env(safe-area-inset-bottom)) !important;
        left: 10px !important;
        right: 10px !important;
        top: auto !important;
        width: auto !important;
        max-height: 50vh !important;
        border-radius: 16px 16px 0 0 !important;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.5) !important;
        z-index: 600 !important;
    }
    
    /* @提及下拉框项目优化 */
    .mention-item {
        padding: 12px 16px !important;
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        cursor: pointer;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        transition: background 0.15s;
    }
    
    .mention-item:hover,
    .mention-item.selected {
        background: rgba(0, 242, 255, 0.1) !important;
    }
    
    .mention-item .avatar {
        width: 36px !important;
        height: 36px !important;
        border-radius: 50% !important;
        background: var(--primary) !important;
        color: #000 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 14px !important;
        font-weight: bold !important;
        flex-shrink: 0 !important;
    }
    
    .mention-item .info {
        flex: 1;
        min-width: 0;
    }
    
    .mention-item .name {
        font-weight: 600;
        color: #fff;
        font-size: 14px;
    }
    
    .mention-item .school {
        font-size: 12px;
        color: #666;
    }
    
    /* 图片预览区域优化 */
    .forum-img-preview {
        margin-top: 8px !important;
        padding: 8px 10px !important;
    }
    
    .forum-img-preview img {
        max-width: 60px !important;
        max-height: 60px !important;
        border-radius: 6px !important;
    }
}

/* === Loading状态动画 === */
.btn-loading {
    position: relative !important;
    pointer-events: none !important;
    opacity: 0.7 !important;
}

.btn-loading::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 20px !important;
    height: 20px !important;
    margin: -10px 0 0 -10px !important;
    border: 2px solid transparent !important;
    border-top-color: currentColor !important;
    border-radius: 50% !important;
    animation: spin 0.8s linear infinite !important;
}

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

/* === 骨架屏占位 === */
.skeleton {
    background: linear-gradient(90deg, 
        rgba(255,255,255,0.05) 25%, 
        rgba(255,255,255,0.1) 50%, 
        rgba(255,255,255,0.05) 75%
    ) !important;
    background-size: 200% 100% !important;
    animation: skeleton-shimmer 1.5s infinite !important;
    border-radius: 8px !important;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 14px !important;
    margin-bottom: 8px !important;
}

.skeleton-title {
    height: 20px !important;
    width: 60% !important;
    margin-bottom: 12px !important;
}

.skeleton-avatar {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
}

/* === 移动端键盘弹出时的适配 === */
@media (max-width: 768px) {
    /* 当输入框聚焦时，调整视图 */
    body.keyboard-open #view-forum .msgs {
        max-height: calc(100vh - 250px) !important;
    }
    
    /* 平滑滚动优化 */
    .msgs, #pm-msg-list, #notif-list {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
}

/* === 高对比度模式支持 === */
@media (prefers-contrast: high) {
    .forum-input-area {
        border-top: 2px solid #fff !important;
    }
    
    .pm-msg .bubble {
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
    }
}

/* === 减少动画模式 === */
@media (prefers-reduced-motion: reduce) {
    .skeleton {
        animation: none !important;
        background: rgba(255, 255, 255, 0.05) !important;
    }
    
    @keyframes spin {
        to { transform: rotate(360deg); }
    }
}

/* ========================================
   Forum Post Actions (评论/举报按钮)
   ======================================== */
.post-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed rgba(255,255,255,0.08);
}

.action-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(0,242,255,0.1);
    color: var(--primary);
}

.report-btn {
    margin-left: auto;
    opacity: 0;
    transition: opacity 0.2s;
}

.forum-post-card:hover .report-btn {
    opacity: 1;
}

/* ========================================
   Comments Section
   ======================================== */
.post-comments-section {
    margin-top: 12px;
    padding: 12px;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.05);
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.comments-loading,
.comments-empty,
.comments-error {
    text-align: center;
    padding: 20px;
    color: #555;
    font-size: 13px;
}

.comments-error { color: #ff4444; }

.comment-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    animation: fadeIn 0.2s ease-out;
}

.comment-item:last-of-type { border-bottom: none; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.comment-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #6c5ce7;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.comment-body { flex: 1; min-width: 0; }

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.comment-author { font-weight: 600; font-size: 13px; color: var(--primary); }
.comment-time { font-size: 11px; color: #555; }

.comment-del {
    margin-left: auto;
    background: none;
    border: none;
    color: #555;
    cursor: pointer;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.15s;
}

.comment-item:hover .comment-del { opacity: 1; }
.comment-del:hover { color: #ff4444; background: rgba(255,68,68,0.1); }

.comment-content { font-size: 13px; color: #ccc; line-height: 1.5; word-break: break-word; }

.comment-input-area {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.comment-input {
    flex: 1;
    height: 36px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: #fff;
    padding: 0 14px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
}

.comment-input:focus {
    border-color: var(--primary);
    background: rgba(0,242,255,0.05);
    box-shadow: 0 0 0 2px rgba(0,242,255,0.1);
}

.comment-input::placeholder { color: #555; }

.comment-submit {
    height: 36px;
    padding: 0 16px;
    border-radius: 18px;
    border: none;
    background: var(--primary);
    color: #000;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.comment-submit:hover { background: #33f5ff; transform: translateY(-1px); }
.comment-submit:active { transform: translateY(0); }

/* ========================================
   Read Status Indicator
   ======================================== */
.msg-read-status {
    display: inline-block;
    margin-left: 6px;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
}

.msg-read-status.read { color: #555; background: rgba(255,255,255,0.05); }
.msg-read-status.unread { color: var(--primary); background: rgba(0,242,255,0.1); }

/* ========================================
   New User Guide Modal
   ======================================== */
#guide-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#guide-overlay.show { opacity: 1; }

.guide-modal {
    background: linear-gradient(145deg, #1a1f2e, #151a25);
    border: 1px solid rgba(0,242,255,0.2);
    border-radius: 14px;
    padding: 18px 20px;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 30px rgba(0,242,255,0.1);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

#guide-overlay.show .guide-modal { transform: scale(1); }

.guide-header { text-align: center; margin-bottom: 12px; }

.guide-logo {
    font-size: 36px;
    margin-bottom: 6px;
    filter: drop-shadow(0 0 12px rgba(0,242,255,0.4));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.guide-header h2 { color: #fff; font-size: 16px; margin: 0; line-height: 1.3; }

.guide-content { margin-bottom: 14px; }

.guide-step {
    display: flex;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    margin-bottom: 6px;
    border: 1px solid rgba(255,255,255,0.05);
    transition: all 0.2s;
}

.guide-step:hover { border-color: rgba(0,242,255,0.2); background: rgba(0,242,255,0.03); }
.step-icon { font-size: 22px; flex-shrink: 0; }
.step-text h3 { color: var(--primary); margin: 0 0 2px 0; font-size: 13px; }
.step-text p { color: #888; margin: 0; font-size: 11px; line-height: 1.3; }

.guide-tip {
    padding: 8px 10px;
    background: rgba(255,200,0,0.1);
    border: 1px solid rgba(255,200,0,0.2);
    border-radius: 8px;
    color: #ffc800;
    font-size: 11px;
    line-height: 1.4;
}

.guide-tip strong { color: #ffdd44; }

.guide-btn {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #0066ff, var(--primary));
    color: #000;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 6px 20px rgba(0,242,255,0.25);
}

.guide-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(0,242,255,0.35); }
.guide-btn:active { transform: translateY(0); }

@media (max-width: 768px) {
    .guide-modal { padding: 14px 16px; border-radius: 12px; max-width: 320px; }
    .guide-header h2 { font-size: 14px; }
    .guide-step { padding: 6px 8px; gap: 8px; }
    .step-icon { font-size: 18px; }
    .step-text h3 { font-size: 12px; }
    .step-text p { font-size: 10px; }
    .guide-tip { font-size: 10px; padding: 6px 8px; }
    .guide-btn { padding: 8px; font-size: 13px; }
}

/* ===== 自由探索：章节卡片网格 ===== */
.free-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 10px;
}
.free-card {
    position: relative;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 14px 12px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.free-card:hover {
    background: rgba(0,242,255,0.08);
    border-color: rgba(0,242,255,0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.free-card:active {
    transform: translateY(0);
}
.free-card-num {
    font-size: 11px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 1px;
}
.card-game .free-card-num {
    color: #ff6b35;
}
.free-card-name {
    font-size: 14px;
    color: #ddd;
    line-height: 1.3;
}
.free-card-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255,107,53,0.2);
    color: #ff6b35;
    font-weight: 600;
}
.card-game {
    border-color: rgba(255,107,53,0.15);
}

@media (max-width: 768px) {
    .free-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
    .free-ch-title { font-size: 13px; }
    .free-card { padding: 10px 10px 10px; border-radius: 10px; }
    .free-card-name { font-size: 13px; }
    .free-card-num { font-size: 10px; }
}

/* ============================================================
   FluidLab AI 模块样式
   ============================================================ */

/* 知识图谱菜单卡片 — 渐变高亮 */
.menu-card-ai {
    position: relative;
    overflow: hidden;
}
.menu-card-ai::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0,242,255,0.08), transparent);
    transition: left 0.6s ease;
}
.menu-card-ai:hover::before {
    left: 100%;
}
.menu-card-ai .menu-icon {
    background: linear-gradient(135deg, rgba(0,242,255,0.15), rgba(77,201,246,0.08));
    border-color: rgba(0,242,255,0.3);
}
.menu-card-ai h3 {
    color: #00b8d4 !important;
}

/* AI 功能角标 */
.menu-card-ai::after {
    content: 'AI';
    position: absolute;
    top: 8px; right: 8px;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    background: linear-gradient(135deg, #00f2ff, #4dc9f6);
    color: #0a0e1a;
    letter-spacing: 1px;
}

/* 知识图谱入口按钮 (导航栏) */
.kg-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    background: linear-gradient(135deg, rgba(0,242,255,0.12), rgba(77,201,246,0.06));
    border: 1px solid rgba(0,242,255,0.3);
    color: #00f2ff;
    transition: all 0.2s ease;
}
.kg-nav-btn:hover {
    background: linear-gradient(135deg, rgba(0,242,255,0.2), rgba(77,201,246,0.12));
    border-color: rgba(0,242,255,0.5);
    box-shadow: 0 0 12px rgba(0,242,255,0.2);
}

/* AI 辅助提示浮窗 */
.ai-hint-bubble {
    position: fixed;
    bottom: 80px; right: 20px;
    max-width: 320px;
    padding: 16px 20px;
    border-radius: 12px;
    background: rgba(10,14,26,0.96);
    border: 1px solid rgba(0,242,255,0.25);
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
    color: #e0e6ed;
    font-size: 14px;
    line-height: 1.6;
    z-index: 99998;
    animation: ai-bubble-in 0.3s ease;
}
@keyframes ai-bubble-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.ai-hint-bubble .ai-hint-title {
    font-size: 13px;
    font-weight: 700;
    color: #00f2ff;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.ai-hint-bubble .ai-hint-close {
    position: absolute;
    top: 8px; right: 10px;
    cursor: pointer;
    color: #666;
    font-size: 16px;
}
.ai-hint-bubble .ai-hint-close:hover {
    color: #ff6b35;
}

/* 空闲提示动画 */
@keyframes ai-idle-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0,242,255,0.3); }
    50% { box-shadow: 0 0 0 8px rgba(0,242,255,0); }
}
.ai-hint-bubble.idle-hint {
    animation: ai-bubble-in 0.3s ease, ai-idle-pulse 2s infinite 0.3s;
    border-color: rgba(255,213,79,0.3);
}
.ai-hint-bubble.idle-hint .ai-hint-title {
    color: #ffd54f;
}

/* ================================================================
   前情提要面板（Prologue Panel）— 全屏沉浸式剧情面板
   ================================================================ */

/* 前情提要面板 - 全屏遮罩 */
.story-prologue-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10000;
    display: flex; align-items: center; justify-content: center;
    background: rgba(8, 9, 13, 0.95);
    opacity: 0; transition: opacity 0.8s ease;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.story-prologue-overlay.active { opacity: 1; }

/* 面板容器 */
.story-prologue-panel {
    width: 90%; max-width: 800px; max-height: 85vh;
    background: linear-gradient(135deg, rgba(18,22,32,0.92), rgba(12,15,24,0.95));
    border: 1px solid rgba(0,242,255,0.15);
    border-radius: 20px;
    padding: 0; overflow: hidden;
    box-shadow: 0 25px 80px rgba(0,0,0,0.6), 0 0 40px rgba(0,242,255,0.08);
    transform: translateY(30px); transition: transform 0.8s cubic-bezier(0.16,1,0.3,1);
    position: relative;
}
.story-prologue-overlay.active .story-prologue-panel {
    transform: translateY(0);
}

/* 章节标题头部 */
.prologue-header {
    padding: 40px 40px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(0,242,255,0.1);
}
.prologue-chapter-num {
    font-size: 14px; color: #00f2ff; letter-spacing: 4px; text-transform: uppercase;
    margin-bottom: 8px;
}
.prologue-title {
    font-size: 32px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, #00f2ff, #26c6da);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}
.prologue-subtitle {
    font-size: 14px; color: rgba(255,255,255,0.5);
}

/* 内容区域 */
.prologue-content {
    padding: 30px 40px;
    max-height: 40vh; overflow-y: auto;
}
.prologue-content::-webkit-scrollbar { width: 4px; }
.prologue-content::-webkit-scrollbar-track { background: transparent; }
.prologue-content::-webkit-scrollbar-thumb { background: rgba(0,242,255,0.3); border-radius: 2px; }
.prologue-section {
    margin-bottom: 20px; opacity: 0; transform: translateY(10px);
    animation: prologueFadeIn 0.6s ease forwards;
}
.prologue-section:nth-child(1) { animation-delay: 0.2s; }
.prologue-section:nth-child(2) { animation-delay: 0.5s; }
.prologue-section:nth-child(3) { animation-delay: 0.8s; }
.prologue-section:nth-child(4) { animation-delay: 1.1s; }
.prologue-section:nth-child(5) { animation-delay: 1.4s; }
.prologue-section:nth-child(6) { animation-delay: 1.7s; }
.prologue-section:nth-child(7) { animation-delay: 2.0s; }
.prologue-section:nth-child(8) { animation-delay: 2.3s; }
.prologue-section:nth-child(9) { animation-delay: 2.6s; }
.prologue-section:nth-child(10) { animation-delay: 2.9s; }
.prologue-section:nth-child(n+11) { animation-delay: 3.2s; }
@keyframes prologueFadeIn {
    to { opacity: 1; transform: translateY(0); }
}
.prologue-scene-tag {
    font-size: 11px; color: #00f2ff; letter-spacing: 2px;
    margin-bottom: 6px; text-transform: uppercase;
    padding: 4px 10px;
    background: rgba(0,242,255,0.05);
    border-radius: 4px;
    display: inline-block;
}
.prologue-text {
    font-size: 15px; line-height: 1.8; color: rgba(255,255,255,0.85);
    font-family: 'Noto Sans SC', 'Inter', sans-serif;
    margin: 0;
}
.prologue-text em {
    color: #00f2ff; font-style: normal; font-weight: 600;
}

/* 角色列表 */
.prologue-characters {
    display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
    padding: 20px 40px; border-top: 1px solid rgba(0,242,255,0.08);
}
.prologue-char-item {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.prologue-avatar {
    width: 48px; height: 48px; border-radius: 50%;
    background: rgba(0,242,255,0.08); border: 1px solid rgba(0,242,255,0.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.prologue-char-item:hover .prologue-avatar {
    transform: scale(1.1);
    box-shadow: 0 0 16px rgba(0,242,255,0.3);
}
.prologue-char-name {
    font-size: 11px; color: rgba(255,255,255,0.6);
}

/* 底部操作区 */
.prologue-footer {
    padding: 24px 40px 32px;
    display: flex; justify-content: space-between; align-items: center;
}
.prologue-skip {
    font-size: 12px; color: rgba(255,255,255,0.3);
    cursor: pointer; background: none; border: none;
    padding: 6px 12px;
    transition: color 0.2s;
}
.prologue-skip:hover { color: rgba(255,255,255,0.7); }

/* 开始旅程按钮 */
.prologue-start-btn {
    flex: 1; max-width: 320px; margin: 0 auto;
    padding: 16px 32px;
    font-size: 16px; font-weight: 600; color: #08090d;
    background: linear-gradient(135deg, #00f2ff, #00d4aa);
    border: none; border-radius: 12px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: all 0.3s ease; position: relative; overflow: hidden;
    font-family: 'Inter', sans-serif; letter-spacing: 1px;
}
.prologue-start-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 30px rgba(0,242,255,0.35);
}
.prologue-start-btn::before {
    content: ''; position: absolute; top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}
.prologue-start-btn:hover::before { left: 100%; }

/* 音乐控制图标 */
.prologue-music-toggle {
    position: absolute; top: 20px; right: 20px;
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.5); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; transition: all 0.2s;
    z-index: 10;
}
.prologue-music-toggle:hover { background: rgba(255,255,255,0.1); color: #fff; }
.prologue-music-toggle.muting { opacity: 0.3; }

/* 响应式 */
@media (max-width: 768px) {
    .story-prologue-panel { width: 95%; max-height: 90vh; border-radius: 16px; }
    .prologue-header { padding: 28px 20px 16px; }
    .prologue-title { font-size: 24px; }
    .prologue-content { padding: 20px 20px; max-height: 35vh; }
    .prologue-text { font-size: 14px; }
    .prologue-characters { padding: 16px 20px; gap: 12px; }
    .prologue-avatar { width: 40px; height: 40px; font-size: 18px; }
    .prologue-footer { padding: 16px 20px 24px; flex-direction: column; gap: 12px; }
    .prologue-start-btn { max-width: 100%; width: 100%; }
    .prologue-music-toggle { top: 12px; right: 12px; }
}

/* ================================================================
   章节卡片内的"开始旅程"按钮
   ================================================================ */
.story-chapter-action {
    padding: 0 20px 20px;
}
.story-journey-btn {
    width: 100%; padding: 14px;
    font-size: 15px; font-weight: 600;
    color: #08090d; letter-spacing: 2px;
    background: linear-gradient(135deg, #00f2ff, #00d4aa);
    border: none; border-radius: 10px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: all 0.3s ease;
    font-family: 'Noto Sans SC', 'Inter', sans-serif;
}
.story-journey-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,242,255,0.3);
}
/* "继续冒险"按钮变体（已看过 intro 时显示） */
.story-journey-btn-continue {
    background: transparent;
    color: rgba(255,255,255,0.6);
    border: 1px solid rgba(0,242,255,0.2);
}
.story-journey-btn-continue:hover {
    background: rgba(0,242,255,0.05);
    color: #00f2ff;
    box-shadow: 0 4px 15px rgba(0,242,255,0.15);
    transform: translateY(-2px);
}

/* 密码显示/隐藏按钮 */
.pwd-toggle { user-select: none; transition: color 0.2s; }
.pwd-toggle:hover { color: #00d4ff !important; }

/* 章节锁定样式 */
.story-chapter-card.chapter-locked { position: relative; opacity: 0.6; pointer-events: none; filter: grayscale(0.5); }
.chapter-lock-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(0,0,0,0.3); border-radius: 12px; z-index: 5; }
.chapter-lock-icon { font-size: 32px; margin-bottom: 8px; }
.chapter-lock-text { color: #ccc; font-size: 13px; text-align: center; padding: 0 20px; }
.story-chapter-card.current-chapter { box-shadow: 0 0 0 3px #00d4ff, 0 0 20px rgba(0,212,255,0.3); transition: box-shadow 0.3s; }

/* ========================================
   个人中心 & 教师面板 弹窗样式
   ======================================== */
.fl-modal { position: fixed; inset: 0; z-index: 2000; background: var(--modal-overlay-bg); justify-content: center; align-items: center; }

/* 弹窗内容宽度覆盖 */
#profile-modal .m-content { width: 450px; max-width: 95%; text-align: left; }
#teacher-modal .m-content { width: 800px; max-width: 95%; text-align: left; }

/* 弹窗头部 */
.m-header { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.m-header h3 { margin: 0; color: var(--primary); font-size: 18px; }

/* 关闭按钮 */
.m-close { font-size: 28px; cursor: pointer; color: var(--text-muted); line-height: 1; transition: color 0.2s; user-select: none; }
.m-close:hover { color: var(--error); }

/* 弹窗主体 */
.m-body { text-align: left; }

/* 主按钮 */
.btn-primary { padding: 10px 16px; border: none; border-radius: 8px; background: var(--primary); color: #000; font-weight: bold; cursor: pointer; transition: 0.2s; }
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.98); }

/* 次按钮 */
.btn-secondary { padding: 10px 16px; border: 1px solid #555; border-radius: 8px; background: transparent; color: #fff; font-weight: bold; cursor: pointer; transition: 0.2s; }
.btn-secondary:hover { background: rgba(255,255,255,0.1); }
.btn-secondary:active { transform: scale(0.98); }

/* 导航栏胶囊按钮 */
.nav-pill { padding: 5px 12px; border-radius: 15px; cursor: pointer; font-weight: bold; white-space: nowrap; transition: 0.2s; }
.nav-pill:hover { filter: brightness(1.15); }

/* 教师面板表格hover效果 */
#teacher-students-tbody tr:hover { background: rgba(0,242,255,0.05); }

/* 响应式：小屏幕下弹窗宽度 */
@media (max-width: 768px) {
    #profile-modal .m-content { width: 92%; }
    #teacher-modal .m-content { width: 95%; }
    .m-header h3 { font-size: 16px; }
}

/* [profile-scroll-fix] */
#profile-modal .m-content {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#profile-modal .m-header { flex: 0 0 auto; }
#profile-modal .m-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
}
