/* ========== 全局变量与基础 ========== */
:root {
    --bg: #0f0f1a;
    --card: #1e1e2f;
    --text: #e0e0e0;
    --accent: #4a9eff;
    --purple: #7c3aed;
    --red: #ef4444;
    --green: #22c55e;
    --yellow: #f59e0b;
    --border: #2a2a3a;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #0f0f1a, #1a1a2e);
    min-height: 100vh; color: var(--text);
    display: flex; flex-direction: column; align-items: center;
    padding-top: var(--safe-top); padding-bottom: var(--safe-bottom);
    overflow-x: hidden;
}

/* ========== 主容器 ========== */
.main-container { width: 100%; max-width: 1100px; padding: 20px 24px; flex: 1; }
@media (max-width: 768px) { .main-container { padding: 12px 10px; } }

/* ========== 覆盖层通用 ========== */
.overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 999999; display: none; justify-content: center; align-items: center;
    background: rgba(0,0,0,0.95); flex-direction: column; padding: 20px;
}
.overlay.active { display: flex; }

/* ========== 人机验证覆盖层 ========== */
#captcha-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: #000; z-index: 99999; display: flex;
    align-items: center; justify-content: center; flex-direction: column;
    transition: opacity 0.6s;
}
#captcha-overlay.hidden { opacity: 0; pointer-events: none; }

.captcha-container {
    background: #111; border: 2px solid var(--purple); border-radius: 24px;
    padding: 40px 30px; max-width: 480px; width: 100%;
    text-align: center; display: flex; flex-direction: column; gap: 24px;
}

.captcha-title { color: #fff; font-size: 1.4rem; font-weight: 700; }

/* IP 显示 */
.ip-display {
    background: #1a1a2e; border-radius: 12px; padding: 10px 16px;
    color: var(--text); font-size: 0.9rem; display: flex; align-items: center;
    justify-content: center; gap: 8px; cursor: pointer; transition: background 0.2s;
    border: 1px solid #2a2a3a;
}
.ip-display:hover { background: #2a2a40; }
.ip-display .ip-text { color: var(--accent); font-weight: 600; font-family: monospace; user-select: text; }
.ip-display .copy-icon { color: #aaa; font-size: 0.9rem; }
.ip-display .copy-feedback { font-size: 0.8rem; color: var(--green); display: none; }

.captcha-trigger-btn {
    background: var(--purple); color: #fff; border: none; padding: 16px 40px;
    border-radius: 40px; font-size: 1.1rem; font-weight: 700; cursor: pointer;
    transition: all 0.3s; box-shadow: 0 0 0 0 rgba(124,58,237,0.6);
}
.captcha-trigger-btn:hover {
    background: #a855f7; box-shadow: 0 0 0 18px rgba(124,58,237,0);
    transform: scale(1.06);
}

/* ========== 隐藏管理员入口 ========== */
#admin-entry {
    position: fixed; top: 20px; left: 20px; z-index: 100001;
    background: rgba(0,0,0,0.7); color: #fff; padding: 6px 14px;
    border-radius: 20px; font-size: 0.8rem; cursor: pointer;
    opacity: 0; transition: opacity 0.3s; backdrop-filter: blur(4px);
}
#admin-entry:hover { opacity: 1; }

/* ========== 密钥输入模态框 ========== */
#key-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9); z-index: 1000002; display: none;
    justify-content: center; align-items: center; flex-direction: column;
}
#key-modal.active { display: flex; }
.key-box {
    background: #1e1e2f; border: 2px solid var(--purple); border-radius: 16px;
    padding: 30px; max-width: 400px; width: 90%; text-align: center;
}
.key-box h3 { color: var(--accent); margin-bottom: 16px; }
.key-input {
    background: #2a2a3a; border: 1px solid #3a3a5a; color: #fff;
    padding: 12px; border-radius: 8px; width: 100%; margin: 16px 0;
    font-family: monospace; text-align: center;
}
.key-error { color: var(--red); font-size: 0.9rem; margin-top: 8px; display: none; }

/* ========== 封禁错误提示弹窗（管理员被封） ========== */
#perm-error-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9); z-index: 1000003; display: none;
    justify-content: center; align-items: center; flex-direction: column;
}
#perm-error-modal.active { display: flex; }
.perm-error-box {
    background: #1a1a1a; border: 2px solid var(--red); border-radius: 20px;
    padding: 30px; max-width: 400px; width: 90%; text-align: center;
}
.perm-error-box h2 { color: var(--red); margin-bottom: 16px; }
.perm-error-box p { color: var(--red); line-height: 1.6; margin-bottom: 20px; }

/* ========== 喇叭公告按钮 ========== */
#announcement-btn {
    position: fixed; top: 20px; right: 20px; z-index: 100001;
    background: var(--yellow); color: #000; width: 40px; height: 40px;
    border-radius: 50%; display: none; align-items: center; justify-content: center;
    cursor: pointer; font-size: 1.2rem; box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    transition: transform 0.2s;
}
#announcement-btn.visible { display: flex; }
#announcement-btn:hover { transform: scale(1.1); }

/* 公告模态框 */
#announcement-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); z-index: 1000000; display: none;
    justify-content: center; align-items: center; flex-direction: column;
}
#announcement-modal.active { display: flex; }
.announcement-box {
    background: #1e1e2f; border: 2px solid var(--accent); border-radius: 16px;
    padding: 30px; max-width: 500px; width: 90%; text-align: left; color: var(--text);
}
.announcement-box h2 { color: var(--accent); margin-bottom: 16px; }
.announcement-box p { line-height: 1.6; margin-bottom: 12px; }

/* 封禁覆盖层 */
.ban-box {
    background: #1a1a1a; border: 2px solid var(--red); border-radius: 20px;
    padding: 40px; text-align: center; max-width: 500px; width: 100%;
}
.ban-box h2 { color: var(--red); font-size: 2rem; margin-bottom: 16px; }
.ban-box .timer { font-size: 2.5rem; font-weight: 700; color: var(--yellow); }

/* 警告弹窗 */
#warning-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); z-index: 1000000; display: none;
    justify-content: center; align-items: center; flex-direction: column;
}
#warning-modal.active { display: flex; }
.warning-box {
    background: #1a1a1a; border: 2px solid var(--yellow); border-radius: 20px;
    padding: 30px; text-align: center; max-width: 450px; color: #fff;
}
.warning-box h2 { color: var(--yellow); margin-bottom: 16px; }

/* 管理员面板 */
#admin-panel { display: none; width: 100%; min-height: 100vh; background: #111; }
#admin-panel.active { display: flex; flex-direction: column; }
.top-bar {
    background: #3a3a4a; padding: 18px 24px; text-align: center;
    font-size: 1.4rem; font-weight: 700; color: var(--accent);
    display: flex; justify-content: space-between; align-items: center;
}
.back-link { color: #ccc; font-size: 0.9rem; cursor: pointer; }
.back-link:hover { color: var(--accent); }
.layout { display: flex; flex: 1; min-height: calc(100vh - 60px); }
.sidebar {
    width: 200px; background: #1a1a2e; padding: 20px 0;
    border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px;
}
.sidebar button {
    background: transparent; border: none; color: #ccc; padding: 12px 20px;
    text-align: left; cursor: pointer; font-size: 1rem; transition: 0.2s;
    border-left: 3px solid transparent;
}
.sidebar button.active { background: #2a2a40; color: var(--accent); border-left-color: var(--accent); }
.content { flex: 1; padding: 24px; overflow-y: auto; }
.page { display: none; }
.page.active { display: block; }
.status-indicator { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; margin-bottom: 16px; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--green); }
.status-dot.error { background: var(--red); }

/* 表格 */
table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; }
th, td { padding: 12px; border-bottom: 1px solid var(--border); text-align: left; }
th { background: #2a2a3a; }

/* 按钮 */
.btn {
    padding: 6px 14px; border-radius: 20px; border: none; cursor: pointer;
    font-weight: 600; margin: 2px; transition: 0.2s; display: inline-block;
}
.btn-blue { background: var(--accent); color: #fff; }
.btn-red { background: var(--red); color: #fff; }
.btn-yellow { background: var(--yellow); color: #000; }
.btn-outline { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
.btn-gray { background: #555; color: #fff; }
.btn:hover { filter: brightness(1.1); }

/* 模态框 */
.modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); z-index: 1000001; justify-content: center; align-items: center;
}
.modal.active { display: flex; }
.modal-content {
    background: #1e1e2f; padding: 30px; border-radius: 16px;
    max-width: 500px; width: 90%; color: var(--text);
}
.modal-content h3 { color: var(--accent); margin-bottom: 16px; }
.close { float: right; cursor: pointer; font-size: 1.5rem; color: #aaa; }

/* 输入框 */
input, select, textarea {
    background: #2a2a3a; border: 1px solid #3a3a5a; color: #fff;
    padding: 8px 12px; border-radius: 8px; width: 100%; margin: 8px 0;
    font-family: inherit;
}
.red-small { color: var(--red); font-size: 0.8rem; margin-top: 4px; }

/* 顶部灰框/卡片/底部等保持不变（略，与之前相同） */
.top-gray-box { background: #3a3a4a; border-radius: 12px; padding: 28px; text-align: center; margin-bottom: 28px; }
.top-gray-box h1 { color: var(--accent); font-size: 2.4rem; }
.cards-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; }
@media (max-width: 950px) { .cards-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
.card { background: var(--card); border-radius: 14px; padding: 22px; box-shadow: 0 4px 15px rgba(0,0,0,0.4); transition: 0.25s; display: flex; flex-direction: column; align-items: center; }
.card:hover { transform: translateY(-6px); box-shadow: 0 8px 25px rgba(0,0,0,0.6); }
.card-btn { background: #2a2a4a; color: var(--accent); padding: 10px 24px; border-radius: 30px; text-decoration: none; font-weight: 600; display: inline-block; }
.bottom-black-box { background: #0a0a0a; border-radius: 14px; padding: 28px; text-align: center; margin-top: auto; }
.copyright-info { font-size: 0.9rem; color: #ccc; margin-bottom: 18px; }
.social-icons { display: flex; gap: 30px; justify-content: center; }
.social-icon-link { color: #ccc; font-size: 28px; transition: 0.25s; text-decoration: none; }
.social-icon-link:hover { color: var(--accent); transform: translateY(-4px); }
.extract-code { font-weight: 700; color: #ffb347; }

/* 验证组件样式（略） */