:root {
    --bg: #f0f6ff;
    --card: #ffffff;
    --primary: #3d8ef8;
    --primary-light: #7ec8ff;
    --primary-dark: #3d6ef8;
    --text: #2c3a6b;
    --text-muted: #8aa0c8;
    --border: #ddeeff;
    --divider: #e8f0ff;
    --shadow: rgba(61,142,248,0.10);
    --gold: #f59e0b;
    --green: #10b981;
    --red: #ef4444;
    --purple: #8b5cf6;
    --radius: 14px;
    --radius-pill: 999px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
    background: #c8d8f0;
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}
#app {
    width: 100%;
    max-width: 430px;
    height: 100dvh;
    height: 100vh;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 60px rgba(0,0,0,0.15);
    overflow: hidden;
}
@media(min-width:640px) {
    #app { max-width: 520px; }
}
@media(min-width:900px) {
    #app { max-width: 640px; }
}
@media(min-width:1200px) {
    #app { max-width: 780px; }
}
#page-container {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 14px 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.25) transparent;
}
#page-container::-webkit-scrollbar { width: 6px; }
#page-container::-webkit-scrollbar-track { background: transparent; }
#page-container::-webkit-scrollbar-thumb { background: rgba(99, 102, 241, 0.25); border-radius: 3px; }
#page-container::-webkit-scrollbar-thumb:hover { background: rgba(99, 102, 241, 0.45); }

/* ===== TAB BAR ===== */
.tab-bar-wrap { flex-shrink: 0; background: white; border-top: 1px solid var(--border); user-select: none; }
.tab-bar {
    width: 100%;
    height: 52px;
    display: flex;
    align-items: center;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    cursor: grab;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-bar.dragging { cursor: grabbing; }
.tab-item { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 25%; height: 100%; cursor: pointer; color: var(--text-muted); transition: color 0.2s; gap: 3px; flex-shrink: 0; scroll-snap-align: start; }
.tab-item.active { color: var(--primary); }
.tab-icon-svg { width: 20px; height: 20px; stroke-width: 2; }
.tab-label { font-size: 11px; font-weight: 500; }
.tab-scroll-indicator { height: 3px; background: var(--border); position: relative; }
.tab-scroll-thumb { height: 100%; background: var(--primary); border-radius: 2px; position: absolute; left: 0; top: 0; transition: left 0.15s, width 0.15s; opacity: 0.7; }
.tab-swipe-hint {
    text-align: center; font-size: 10px; color: var(--text-muted); padding: 3px 0 2px;
    opacity: 0; animation: swipeHintIn 0.6s 1s forwards, swipeHintOut 0.8s 5s forwards;
    pointer-events: none; display: flex; align-items: center; justify-content: center; gap: 4px;
}
.tab-swipe-hint span { display: inline-block; animation: swipeArrow 1.5s 1.2s ease-in-out 3; }
@keyframes swipeHintIn { to { opacity: 0.7; } }
@keyframes swipeHintOut { to { opacity: 0; } }
@keyframes swipeArrow { 0%,100% { transform: translateX(0); } 50% { transform: translateX(5px); } }

/* ===== ICONS ===== */
.icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon svg, i[data-lucide] svg { width: 16px; height: 16px; stroke-width: 2; }
.icon-sm svg { width: 14px; height: 14px; }
.icon-lg svg { width: 22px; height: 22px; }

/* ===== CARD ===== */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: 0 2px 12px var(--shadow); border: 1px solid var(--border); }
.card-title { font-size: 15px; font-weight: 700; color: var(--primary); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }

/* ===== SERVER SELECTOR ===== */
.server-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: white;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    flex-shrink: 0;
}
.server-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    color: var(--text-muted);
    background: var(--bg);
    transition: all 0.2s;
}
.server-chip.active { background: linear-gradient(135deg, var(--primary-light), var(--primary)); color: white; border-color: transparent; box-shadow: 0 2px 8px rgba(61,142,248,0.30); }
.server-chip .conn-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.5; }
.server-chip.active .conn-dot { opacity: 1; background: #a8f5c0; }
.server-chip.disconnected .conn-dot { background: var(--red); }
.server-chip:not(.disconnected):not(.connecting) .conn-dot { background: #4ade80; opacity: 1; }

/* ===== HEADER BANNER ===== */
.header-banner { background: linear-gradient(135deg, #5ba8ff, var(--primary-dark)); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: 0 6px 20px rgba(61,110,248,0.28); }
.header-row { display: flex; align-items: center; justify-content: space-between; }
.header-left { display: flex; align-items: center; gap: 8px; }
.header-icon { color: white; opacity: 0.9; }
.header-icon svg { width: 24px; height: 24px; }
.server-name { font-size: 20px; font-weight: 700; color: #fff; letter-spacing: 0.5px; }
.ws-status { display: flex; align-items: center; gap: 5px; }
.ws-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.35); transition: all 0.3s; }
.ws-dot.live { background: #a8f5c0; box-shadow: 0 0 6px rgba(168,245,192,0.9); }
.ws-label { font-size: 11px; color: rgba(255,255,255,0.75); }

/* ===== STATS GRID ===== */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.stat-card { background: white; border-radius: 12px; padding: 12px 10px; text-align: center; border: 1px solid var(--border); box-shadow: 0 2px 8px var(--shadow); }
.stat-icon { color: var(--primary); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.stat-icon svg { width: 18px; height: 18px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-value.stat-value-sm { font-size: 15px; }
.stat-value.ok { color: var(--green); }
.stat-value.warn { color: var(--gold); }
.stat-value.bad { color: var(--red); }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.stat-sub { font-size: 9px; color: var(--text-muted); margin-top: 2px; opacity: 0.7; }

/* ===== SECTION HEADER ===== */
.section-header { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.section-title { font-size: 15px; font-weight: 700; color: var(--primary); }

/* ===== PLAYER LIST ===== */
.player-list { display: flex; flex-direction: column; gap: 8px; }
.player-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--divider); }
.player-row:last-child { border-bottom: none; }
.player-avatar { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 700; color: white; flex-shrink: 0; }
img.player-avatar { object-fit: cover; display: block; }
img.profile-avatar { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; display: block; margin: 0 auto 10px; box-shadow: 0 4px 12px rgba(61,110,248,0.3); }
.player-info { flex: 1; }
.player-name { font-size: 14px; font-weight: 600; color: var(--text); }
.player-ping { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 3px; margin-top: 1px; }
.player-ping svg { width: 12px; height: 12px; }
.ping-good { color: var(--green); }
.ping-ok { color: var(--gold); }
.ping-bad { color: var(--red); }

/* ===== EMPTY / LOADING ===== */
.empty-tip { text-align: center; color: var(--text-muted); padding: 20px 0; font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.empty-tip svg { width: 16px; height: 16px; }

/* ===== ROW ===== */
.row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
.row + .row { border-top: 1px solid var(--divider); }
.label { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.label svg { width: 14px; height: 14px; }
.value { font-size: 14px; font-weight: 500; color: var(--text); }
.value-highlight { font-size: 14px; font-weight: 700; color: var(--primary); }
.value-gold { font-size: 14px; font-weight: 700; color: var(--gold); }

/* ===== TAGS ===== */
.tag { display: inline-flex; align-items: center; border-radius: var(--radius-pill); padding: 2px 10px; font-size: 11px; font-weight: 700; gap: 4px; }
.tag svg { width: 11px; height: 11px; }
.tag-gold { background: #fff8e8; color: var(--gold); }
.tag-blue { background: #e8f2ff; color: var(--primary); }
.tag-green { background: #e8faf4; color: var(--green); }
.tag-red { background: #ffe8ec; color: var(--red); }

/* ===== BUTTONS ===== */
.btn { width: 100%; height: 44px; border: none; border-radius: var(--radius-pill); font-size: 15px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; transition: opacity 0.15s; }
.btn svg { width: 16px; height: 16px; }
.btn:active { opacity: 0.8; }
.btn-primary { background: linear-gradient(135deg, var(--primary-light), var(--primary)); color: white; box-shadow: 0 4px 12px rgba(61,142,248,0.30); }
.btn-secondary { background: white; color: var(--text-muted); border: 1px solid var(--border); }

/* ===== TAB SWITCH ===== */
.tab-switch { display: flex; background: white; border-radius: var(--radius); padding: 4px; margin-bottom: 12px; box-shadow: 0 2px 10px var(--shadow); border: 1px solid var(--border); }
.tab-switch-item { flex: 1; text-align: center; height: 36px; line-height: 36px; border-radius: 10px; font-size: 14px; color: var(--text-muted); cursor: pointer; transition: all 0.2s; font-weight: 500; }
.tab-switch-item.active { background: linear-gradient(135deg, var(--primary-light), var(--primary)); color: white; font-weight: 700; box-shadow: 0 2px 8px rgba(61,142,248,0.30); }

/* ===== RANK ===== */
.rank-item { display: flex; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--divider); }
.rank-item:last-child { border-bottom: none; }
.rank-badge { width: 36px; height: 36px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; margin-right: 10px; flex-shrink: 0; }
.rank-badge.r1 { background: #fff8e8; }
.rank-badge.r2 { background: #f5f7fa; }
.rank-badge.r3 { background: #fff4ec; }
.rank-badge svg { width: 20px; height: 20px; }
.rank-num { font-size: 13px; color: var(--text-muted); font-weight: 700; }
.rank-info { flex: 1; }
.rank-name { font-size: 15px; color: var(--text); }
.rank-name-link { cursor: pointer; transition: color 0.15s; }
.rank-name-link:hover { color: var(--primary); text-decoration: underline; }
.rank-name.me { color: var(--primary); font-weight: 700; }
.rank-value { font-size: 16px; font-weight: 700; color: var(--primary); }

/* ===== DAILY STATS ===== */
.daily-stats-grid { display: flex; justify-content: space-around; padding: 8px 0 4px; }
.daily-stat-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.daily-stat-value { font-size: 22px; font-weight: 800; color: var(--primary); line-height: 1; }
.daily-stat-label { font-size: 11px; color: var(--text-muted); font-weight: 500; }

/* ===== PROFILE ===== */
.bind-hero { text-align: center; padding: 32px 0 20px; }
.bind-hero-icon { color: var(--primary); display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.bind-hero-icon svg { width: 52px; height: 52px; stroke-width: 1.5; }
.bind-hero-title { font-size: 22px; font-weight: 700; color: var(--primary); display: block; }
.bind-hero-desc { font-size: 13px; color: var(--text-muted); display: block; margin-top: 6px; }
.code-input { width: 100%; height: 48px; background: var(--bg); border: 2px solid #b8d4ff; border-radius: var(--radius); text-align: center; font-size: 24px; letter-spacing: 8px; color: var(--primary); font-weight: 700; outline: none; transition: border-color 0.2s; }
.code-input:focus { border-color: var(--primary); }
.step-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.step-num { width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(135deg, var(--primary-light), var(--primary)); color: white; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.step-text { font-size: 13px; color: #3a6aaa; }

.profile-header { background: linear-gradient(160deg, #e8f4ff, #ddeeff); border-radius: var(--radius); border: 1px solid #c8e4ff; padding: 20px 16px; text-align: center; margin-bottom: 12px; }
.profile-avatar { width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; box-shadow: 0 4px 12px rgba(61,110,248,0.3); font-size: 24px; font-weight: 700; color: white; background: linear-gradient(135deg, var(--primary-light), var(--primary-dark)); }
.profile-name { font-size: 20px; font-weight: 700; color: var(--text); }
.profile-xuid { font-size: 11px; color: var(--text-muted); margin-top: 4px; word-break: break-all; display: flex; align-items: center; justify-content: center; gap: 4px; }
.profile-xuid svg { width: 12px; height: 12px; }
.online-badge { display: inline-flex; align-items: center; gap: 4px; border-radius: var(--radius-pill); padding: 3px 12px; font-size: 12px; font-weight: 700; margin-top: 8px; }
.online-badge svg { width: 12px; height: 12px; }
.online-badge.on { background: #e8faf4; color: var(--green); }
.online-badge.off { background: #f0f4ff; color: var(--text-muted); }

/* ===== GUILD ===== */
.guild-item { cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s; }
.guild-item.expanded { border-color: #90c4ff; box-shadow: 0 4px 18px rgba(61,142,248,0.16); }
.guild-header { display: flex; align-items: center; justify-content: space-between; }
.guild-left { display: flex; align-items: center; flex: 1; gap: 10px; }
.guild-badge { width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, var(--primary-light), var(--primary-dark)); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; color: white; box-shadow: 0 2px 8px rgba(61,110,248,0.28); flex-shrink: 0; }
.guild-meta { display: flex; flex-direction: column; gap: 4px; }
.guild-name { font-size: 16px; font-weight: 700; color: var(--text); }
.guild-arrow { color: #aac0e0; }
.guild-arrow svg { width: 16px; height: 16px; }
.guild-detail-section { margin-top: 12px; }
.section-label { font-size: 12px; color: #aac0e0; margin-bottom: 6px; letter-spacing: 1px; }
.member-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--divider); }
.member-item:last-child { border-bottom: none; }
.member-name { font-size: 14px; color: #3a6aaa; }
.member-right { display: flex; align-items: center; gap: 6px; }
.member-contrib { font-size: 13px; color: var(--primary); font-weight: 700; }

/* ===== CONNECTING DOT ===== */
@keyframes pulse-dot { 0%,100% { opacity:0.8; } 50% { opacity:0.25; } }
.server-chip.connecting .conn-dot { background: var(--gold); animation: pulse-dot 1.4s ease-in-out infinite; }

/* ===== PLAYER ROW LINK ===== */
.player-row-link { cursor: pointer; border-radius: 8px; transition: background 0.15s; }
.player-row-link:active { background: var(--divider); }

/* ===== CHAT PAGE ===== */
#chat-page { display: flex; flex-direction: column; height: 100%; min-height: 0; margin: -12px -14px -16px; }
.chat-tab-bar { display: flex; gap: 6px; padding: 10px 12px 0; flex-shrink: 0; }
.chat-tab { display: flex; align-items: center; gap: 5px; padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border); background: var(--bg); color: var(--text-muted); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.18s; white-space: nowrap; }
.chat-tab svg { width: 14px; height: 14px; }
.chat-tab.active { background: var(--primary); color: white; border-color: transparent; box-shadow: 0 2px 8px rgba(61,142,248,0.3); }
.chat-messages { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 0; }
.chat-input-area { flex-shrink: 0; padding: 8px 12px; border-top: 1px solid var(--border); background: white; }
.chat-input-row { display: flex; gap: 8px; align-items: center; }
.chat-input { flex: 1; padding: 8px 12px; border-radius: 20px; border: 1px solid var(--border); background: var(--bg); font-size: 14px; outline: none; transition: border-color 0.2s; }
.chat-input:focus { border-color: var(--primary); }
.chat-send-btn { width: 38px; height: 38px; border-radius: 50%; background: var(--primary); color: white; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: background 0.2s; }
.chat-send-btn:disabled { background: var(--border); cursor: not-allowed; }
.chat-send-btn svg { width: 16px; height: 16px; }
.chat-line { display: flex; align-items: baseline; gap: 6px; padding: 2px 4px; font-size: 13px; line-height: 1.6; border-radius: 4px; }
.chat-line:hover { background: rgba(0,0,0,0.03); }
.cl-av { width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: white; position: relative; top: 2px; }
.cl-body { flex: 1; word-break: break-word; }
.cl-guild { font-size: 10px; color: #10b981; background: rgba(16,185,129,0.1); padding: 1px 4px; border-radius: 3px; margin-right: 3px; }
.cl-vip { font-size: 10px; color: #f59e0b; font-weight: 700; margin-right: 2px; }
.cl-title { font-size: 10px; color: #f59e0b; background: rgba(245,158,11,0.1); padding: 1px 4px; border-radius: 3px; margin-right: 3px; }
.cl-pmdir { font-size: 10px; color: #8b5cf6; background: rgba(139,92,246,0.1); padding: 1px 4px; border-radius: 3px; margin-right: 3px; }
.cl-name { font-weight: 600; color: var(--text); }
.cl-name-link { cursor: pointer; transition: color 0.15s; }
.cl-name-link:hover { color: var(--primary); text-decoration: underline; }
.cl-self-name { color: var(--primary); }
.cl-sep { color: var(--text-muted); }
.cl-msg { color: var(--text); }
.cl-time { font-size: 10px; color: var(--text-muted); flex-shrink: 0; white-space: nowrap; margin-left: 4px; }
.cl-optimistic { opacity: 0.55; }
.web-badge { font-size: 10px; background: rgba(61,142,248,0.12); color: var(--primary); padding: 1px 4px; border-radius: 4px; margin-right: 3px; }
.friend-bar { display: flex; gap: 6px; padding-bottom: 8px; overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
.friend-bar::-webkit-scrollbar { display: none; }
.friend-bar.hidden { display: none; }
.friend-chip { padding: 4px 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg); color: var(--text-muted); font-size: 12px; cursor: pointer; white-space: nowrap; flex-shrink: 0; transition: all 0.18s; }
.friend-chip.active { background: var(--primary); color: white; border-color: transparent; }
.friend-bar-empty { font-size: 12px; color: var(--text-muted); padding: 4px; }

/* ===== BAN OVERLAY ===== */
.ban-overlay-wrap { position: relative; }
.ban-overlay {
    position: fixed;
    inset: 0;
    background: rgba(239,68,68,0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    pointer-events: none;
}
.ban-stamp {
    border: 4px solid var(--red);
    border-radius: 8px;
    padding: 6px 18px;
    color: var(--red);
    font-size: 30px;
    font-weight: 900;
    letter-spacing: 6px;
    transform: rotate(-18deg);
    opacity: 0.82;
    text-shadow: 0 0 8px rgba(239,68,68,0.3);
}
.ban-detail {
    margin-top: 6px;
    font-size: 12px;
    color: var(--red);
    opacity: 0.85;
    text-align: center;
    line-height: 1.7;
    transform: rotate(-18deg);
    font-weight: 600;
}

/* ===== FORUM ===== */
.forum-stats-bar { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px; box-shadow: 0 2px 8px var(--shadow); border: 1px solid var(--border); }
.forum-stat { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.forum-stat-val { font-size: 20px; font-weight: 800; color: var(--primary); line-height: 1; }
.forum-stat-lbl { font-size: 10px; color: var(--text-muted); font-weight: 500; }
.forum-stat-div { width: 1px; height: 28px; background: var(--divider); flex-shrink: 0; }
.forum-search-wrap { position: relative; margin-bottom: 8px; }
.forum-search-box { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; transition: border-color 0.2s; }
.forum-search-box:focus-within { border-color: var(--primary); }
.forum-search-input { flex: 1; border: none; outline: none; background: transparent; font-size: 13px; color: var(--text); font-family: inherit; }
.forum-search-clear { background: none; border: none; padding: 0; cursor: pointer; display: flex; align-items: center; color: var(--text-muted); flex-shrink: 0; }
.forum-search-dropdown { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px var(--shadow); z-index: 100; overflow: hidden; }
.forum-dropdown-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; cursor: pointer; transition: background 0.15s; border-bottom: 1px solid var(--divider); }
.forum-dropdown-item:last-child { border-bottom: none; }
.forum-dropdown-item:active { background: var(--bg); }
.forum-dropdown-title { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.forum-dropdown-author { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.forum-sort-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.forum-sort-lbl { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.forum-sort-btn { padding: 4px 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg); color: var(--text-muted); font-size: 12px; cursor: pointer; transition: all 0.15s; }
.forum-sort-btn.active { background: var(--primary); color: white; border-color: transparent; font-weight: 600; }
.forum-order-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-muted); flex-shrink: 0; transition: all 0.15s; }
.forum-order-btn:active { background: var(--primary-light); color: var(--primary); }
.forum-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; min-height: 36px; }
.forum-title { font-size: 16px; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 6px; }
.forum-title svg { width: 18px; height: 18px; }
.forum-card { background: var(--card); border-radius: var(--radius); padding: 13px 14px; margin-bottom: 10px; box-shadow: 0 2px 8px var(--shadow); border: 1px solid var(--border); cursor: pointer; transition: box-shadow 0.15s; }
.forum-card:active { box-shadow: 0 4px 18px var(--shadow); }
.forum-card-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 8px; line-height: 1.4; }
.forum-card-meta { display: flex; align-items: center; gap: 7px; }
.forum-card-author { font-size: 12px; color: var(--text-muted); flex: 1; }
.forum-card-time { font-size: 11px; color: var(--text-muted); }
.forum-card-replies { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.forum-post-card { margin-bottom: 10px; }
.forum-post-title { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 12px; line-height: 1.4; }
.forum-post-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--divider); }
.forum-post-meta-info { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.forum-post-author { font-size: 13px; font-weight: 600; color: var(--text); }
.forum-author-link { cursor: pointer; color: var(--primary); }
.forum-post-time { font-size: 11px; color: var(--text-muted); }
.forum-post-body { font-size: 14px; line-height: 1.75; color: var(--text); overflow-x: auto; }
.forum-replies-header { font-size: 13px; font-weight: 700; color: var(--text-muted); margin: 12px 0 8px; padding-left: 4px; }
.forum-reply-count { color: var(--primary); }
.forum-reply-item { background: var(--card); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; border: 1px solid var(--border); }
.forum-reply-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.forum-reply-author-link { font-size: 12px; font-weight: 600; color: var(--primary); cursor: pointer; }
.forum-reply-num { font-size: 11px; color: var(--text-muted); margin-left: auto; flex-shrink: 0; }
.forum-reply-body { font-size: 13px; line-height: 1.7; color: var(--text); overflow-x: auto; }
.forum-reply-card { margin-top: 4px; }
.forum-reply-textarea { width: 100%; min-height: 88px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--text); resize: vertical; outline: none; font-family: inherit; transition: border-color 0.2s; }
.forum-reply-textarea:focus { border-color: var(--primary); }
.forum-title-input { width: 100%; height: 42px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; font-size: 15px; color: var(--text); outline: none; font-family: inherit; transition: border-color 0.2s; }
.forum-title-input:focus { border-color: var(--primary); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn-ghost:active { background: var(--bg); }
.btn-danger-ghost { background: transparent; border: 1px solid var(--red); color: var(--red); border-radius: 8px; padding: 4px 8px; }
.btn-danger-ghost:active { background: rgba(239,68,68,0.08); }
.markdown-body h1,.markdown-body h2,.markdown-body h3 { font-weight: 700; margin: 12px 0 6px; color: var(--text); }
.markdown-body h1 { font-size: 18px; } .markdown-body h2 { font-size: 16px; } .markdown-body h3 { font-size: 14px; }
.markdown-body p { margin: 6px 0; }
.markdown-body code { background: var(--bg); border-radius: 4px; padding: 1px 5px; font-size: 12px; color: var(--purple); font-family: monospace; }
.markdown-body pre { background: var(--bg); border-radius: 8px; padding: 10px 12px; overflow-x: auto; margin: 8px 0; }
.markdown-body pre code { background: none; padding: 0; color: var(--text); }
.markdown-body blockquote { border-left: 3px solid var(--primary-light); padding-left: 10px; color: var(--text-muted); margin: 6px 0; font-style: italic; }
.markdown-body ul,.markdown-body ol { padding-left: 20px; margin: 6px 0; }
.markdown-body li { margin: 3px 0; }
.markdown-body a { color: var(--primary); text-decoration: underline; }
.markdown-body hr { border: none; border-top: 1px solid var(--divider); margin: 10px 0; }
.markdown-body strong { font-weight: 700; }
.markdown-body em { font-style: italic; }

/* ===== CUSTOM EDITOR ===== */
.ced-wrap { position: relative; border: 1.5px solid var(--border); border-radius: 14px; background: var(--card); box-shadow: 0 2px 10px var(--shadow); overflow: visible; }
.ced-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.10), 0 2px 10px var(--shadow); }
.ced-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 3px; padding: 7px 10px; border-bottom: 1.5px solid var(--divider); background: var(--bg); border-radius: 13px 13px 0 0; }
.ced-group { display: flex; align-items: center; gap: 1px; background: var(--card); border: 1px solid var(--border); border-radius: 7px; padding: 2px; flex-shrink: 0; }
.ced-group-end { margin-left: auto; }
.ced-btn { padding: 0 8px; min-width: 28px; height: 26px; border: none; border-radius: 5px; background: none; cursor: pointer; font-size: 13px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; transition: background 0.12s, color 0.12s; display: inline-flex; align-items: center; justify-content: center; font-family: inherit; line-height: 1; }
.ced-btn:hover { background: var(--divider); color: var(--text); }
.ced-btn.ced-active { background: var(--primary); color: #fff; border-radius: 5px; }
.ced-btn:active { opacity: 0.75; }
.ced-italic i { font-style: italic; }
.ced-under u { text-decoration: underline; }
.ced-h-btn { font-size: 11px; font-weight: 800; letter-spacing: -0.5px; }
.ced-a-color b { font-size: 15px; font-weight: 900; color: #e22; text-decoration: underline; text-decoration-color: #e22; text-underline-offset: 2px; }
.ced-bg-color b { font-size: 15px; font-weight: 900; color: var(--text); background: linear-gradient(180deg, transparent 55%, #ff0 55%); padding: 0 1px; }
.ced-mono { font-family: monospace; font-size: 12px; }
.ced-body { padding: 14px 16px; outline: none; line-height: 1.85; font-size: 14px; color: var(--text); word-break: break-word; border-radius: 0 0 13px 13px; position: relative; min-height: 100px; caret-color: var(--primary); }
.ced-body.ced-ph::before { content: attr(data-ph); color: var(--text-muted); pointer-events: none; position: absolute; top: 14px; left: 16px; font-size: 14px; }
.ced-body:focus { outline: none; }
.ced-body h1 { font-size: 22px; font-weight: 800; margin: 12px 0 4px; line-height: 1.3; color: var(--text); }
.ced-body h2 { font-size: 18px; font-weight: 700; margin: 10px 0 4px; color: var(--text); }
.ced-body h3 { font-size: 15px; font-weight: 700; margin: 8px 0 3px; color: var(--text); }
.ced-body blockquote { border-left: 3px solid var(--primary); background: var(--bg); padding: 6px 12px; color: var(--text-muted); margin: 8px 0; border-radius: 0 6px 6px 0; font-style: italic; }
.ced-body pre.ced-pre { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; overflow-x: auto; margin: 8px 0; font-family: 'Consolas','Monaco',monospace; font-size: 13px; white-space: pre-wrap; color: var(--text); }
.ced-body code.ced-code { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 12px; color: #9333ea; font-family: 'Consolas','Monaco',monospace; }
.ced-body table.ced-tbl { border-collapse: collapse; width: 100%; margin: 10px 0; border-radius: 6px; overflow: hidden; }
.ced-body table.ced-tbl td { border: 1px solid var(--border); padding: 7px 10px; min-width: 60px; font-size: 13px; }
.ced-body table.ced-tbl tr:first-child td { background: var(--bg); font-weight: 600; }
.ced-body img { max-width: 100%; border-radius: 8px; margin: 6px 0; display: block; box-shadow: 0 2px 8px var(--shadow); }
.ced-img-wrap { position: relative; display: inline-block; max-width: 100%; margin: 6px 0; }
.ced-img-wrap img { outline: 2px solid var(--primary); outline-offset: 2px; margin: 0; cursor: default; }
.ced-img-handle { position: absolute; right: -6px; bottom: -6px; width: 14px; height: 14px; background: var(--primary); border: 2px solid var(--card); border-radius: 3px; cursor: nwse-resize; z-index: 10; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.ced-img-handle:hover { transform: scale(1.2); }
.ced-body a { color: var(--primary); text-decoration: underline; }
.ced-body ul { padding-left: 22px; margin: 4px 0; list-style: disc; }
.ced-body ol { padding-left: 22px; margin: 4px 0; list-style: decimal; }
.ced-body li { margin: 2px 0; }
.ced-body p { margin: 2px 0; }
.ced-popup { position: absolute; z-index: 400; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px var(--shadow); padding: 12px; width: 224px; animation: ced-pop 0.15s ease; }
@keyframes ced-pop { from { opacity:0; transform:translateY(-6px) scale(0.97); } to { opacity:1; transform:translateY(0) scale(1); } }
.ced-popup-title { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }
.ced-color-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.ced-sw { width: 26px; height: 26px; border-radius: 6px; cursor: pointer; border: 1.5px solid rgba(0,0,0,0.08); transition: transform 0.1s, box-shadow 0.1s; }
.ced-sw:hover { transform: scale(1.2); box-shadow: 0 2px 6px rgba(0,0,0,0.2); }
.ced-ep { grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 8px; width: 320px; }
.ced-emo { cursor: pointer; border-radius: 6px; padding: 5px 4px; transition: background 0.1s; font-size: 11px; text-align: center; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.ced-emo:hover { background: var(--bg); }
.ced-select { height: 26px; padding: 0 6px; border: none; border-radius: 5px; background: none; color: var(--text-muted); font-size: 12px; cursor: pointer; outline: none; font-family: inherit; min-width: 54px; }
.ced-select:hover { background: var(--divider); color: var(--text); }
.ced-custom-color { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--divider); }
.ced-cc-lbl { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.ced-cc-input { width: 36px; height: 26px; border: 1px solid var(--border); border-radius: 5px; cursor: pointer; padding: 1px; background: none; flex-shrink: 0; }
.ced-cc-ok { flex: 1; height: 26px; border: none; border-radius: 5px; background: var(--primary); color: #fff; font-size: 12px; cursor: pointer; font-family: inherit; }
.ced-link-inp { display: block; width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1px solid var(--border); border-radius: 7px; font-size: 13px; color: var(--text); background: var(--bg); margin-bottom: 6px; outline: none; font-family: inherit; }
.ced-link-inp:focus { border-color: var(--primary); }
.ced-link-ok { width: 100%; padding: 7px 0; border: none; border-radius: 7px; background: var(--primary); color: #fff; font-size: 13px; cursor: pointer; font-family: inherit; font-weight: 600; }
.ced-link-ok:hover { opacity: 0.9; }
.ced-upl-tip { font-size: 12px; color: var(--text-muted); }
.forum-toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--card); border: 1px solid var(--border); border-radius: 22px; padding: 10px 20px; font-size: 13px; color: var(--text); box-shadow: 0 8px 24px var(--shadow); z-index: 9999; opacity: 0; transition: opacity 0.25s, transform 0.25s; pointer-events: none; white-space: nowrap; max-width: 90vw; text-align: center; }
.forum-toast.forum-toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.forum-toast.forum-toast-error { border-color: #fca5a5; background: #fef2f2; color: #dc2626; }
.forum-toast.forum-toast-success { border-color: #86efac; background: #f0fdf4; color: #16a34a; }
.forum-toast.forum-toast-info { border-color: var(--primary); }
/* ===== FORUM CATEGORIES ===== */
.forum-cats { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.forum-cat-btn { padding: 4px 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg); color: var(--text-muted); font-size: 12px; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.forum-cat-btn.active { background: var(--primary); color: #fff; border-color: transparent; font-weight: 600; }
.forum-card-top { display: flex; align-items: flex-start; gap: 7px; margin-bottom: 7px; }
.forum-card-top .forum-card-title { margin-bottom: 0; flex: 1; }
.forum-tag { display: inline-block; padding: 1px 8px; border-radius: 8px; font-size: 11px; font-weight: 600; flex-shrink: 0; margin-top: 2px; }
.forum-tag-问题反馈 { background: #fef2f2; color: #dc2626; }
.forum-tag-交流 { background: #eff6ff; color: #2563eb; }
.forum-tag-举报玩家 { background: #fff7ed; color: #c2410c; }
.forum-tag-玩法攻略 { background: #f0fdf4; color: #16a34a; }
.forum-card-likes { font-size: 11px; color: #ef4444; display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
/* ===== FORUM LIKE ===== */
.forum-post-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--divider); }
.forum-like-btn { display: flex; align-items: center; gap: 5px; border: 1px solid var(--border); border-radius: 16px; padding: 5px 14px; background: var(--bg); color: var(--text-muted); font-size: 13px; cursor: pointer; transition: all 0.15s; }
.forum-like-btn.liked { background: #fef2f2; border-color: #fca5a5; color: #ef4444; }
.forum-like-btn:active { transform: scale(0.96); }
.forum-like-display { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-muted); }
/* ===== FORUM REPLY-TO ===== */
.forum-reply-btn { margin-left: auto; background: none; border: 1px solid var(--border); border-radius: 10px; padding: 2px 10px; font-size: 11px; color: var(--text-muted); cursor: pointer; flex-shrink: 0; transition: all 0.15s; }
.forum-reply-btn:active { background: var(--primary-light); color: var(--primary); }
.forum-reply-quote { background: var(--bg); border-left: 3px solid var(--primary); border-radius: 0 6px 6px 0; padding: 5px 10px; margin-bottom: 8px; font-size: 12px; color: var(--text-muted); }
.forum-reply-quote-text { color: var(--text-muted); }
/* ===== ADMIN PANEL ===== */
.admin-wrap { padding-bottom: 8px; }
.admin-header { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 800; color: var(--text); margin-bottom: 12px; }
.admin-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; -webkit-overflow-scrolling: touch; scrollbar-width: none; flex-wrap: nowrap; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab-btn { flex-shrink: 0; padding: 6px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg); color: var(--text-muted); font-size: 13px; cursor: pointer; transition: all 0.15s; }
.admin-tab-btn.active { background: var(--primary); color: #fff; border-color: transparent; font-weight: 600; }
.admin-section { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); padding: 12px 14px; margin-bottom: 10px; }
.admin-search-row { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }
.admin-search-row .admin-input { flex: 1; width: auto; margin-bottom: 0; }
.admin-sub-title { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.admin-input { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-size: 13px; color: var(--text); outline: none; font-family: inherit; transition: border-color 0.2s; box-sizing: border-box; margin-bottom: 8px; }
.admin-input:focus { border-color: var(--primary); }
.admin-input:last-child { margin-bottom: 0; }
.admin-player-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--divider); }
.admin-player-row:last-child { border-bottom: none; }
.admin-player-info { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.admin-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); flex-shrink: 0; }
.admin-dot.online { background: #10b981; }
.admin-player-name { font-size: 13px; font-weight: 600; color: var(--text); }
.admin-player-xuid { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 90px; }
.admin-player-btns { display: flex; gap: 4px; flex-shrink: 0; flex-wrap: wrap; }
.admin-eco-balance { font-size: 12px; color: var(--primary); background: var(--primary-light); border-radius: 8px; padding: 6px 10px; margin-bottom: 8px; }
.btn-xs { padding: 3px 9px; font-size: 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text-muted); cursor: pointer; transition: all 0.15s; }
.btn-xs:active { background: var(--primary-light); color: var(--primary); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.admin-table th { text-align: left; color: var(--text-muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--divider); white-space: nowrap; }
.admin-table td { padding: 8px 8px; border-bottom: 1px solid var(--divider); color: var(--text); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 8000; display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px); }
.admin-modal { background: var(--card); border-radius: 16px; padding: 20px; width: 100%; max-width: 340px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); border: 1px solid var(--border); }
.admin-modal-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 14px; }
.admin-modal-body { margin-bottom: 14px; }
.admin-modal-footer { display: flex; justify-content: flex-end; gap: 8px; }

/* ===== UTIL ===== */
.divider { height: 1px; background: var(--divider); margin: 4px 0; }
.mt-12 { margin-top: 12px; }
.flex-row { display: flex; gap: 10px; }
.flex-1 { flex: 1; }
