/* ===== 全局样式 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --primary: #4A90D9;
    --primary-dark: #357ABD;
    --success: #52C41A;
    --danger: #FF4D4F;
    --warning: #FAAD14;
    --bg: #F5F7FA;
    --card-bg: #FFFFFF;
    --text: #333333;
    --text-secondary: #999999;
    --border: #E8E8E8;
    --nav-height: 56px;
    --top-nav-height: 48px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
}
a { color: var(--primary); text-decoration: none; }
input, select, button, textarea { font-family: inherit; font-size: inherit; outline: none; }
input, select { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; width: 100%; background: #fff; }
input:focus, select:focus { border-color: var(--primary); }
button { cursor: pointer; border: none; border-radius: 8px; }

/* ===== 顶部导航 ===== */
.top-nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: var(--top-nav-height); background: #fff;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px; box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.top-nav-title { font-size: 16px; font-weight: 600; color: var(--text); }
.top-nav-right { position: relative; }
.lang-switch { padding: 4px; cursor: pointer; color: var(--text-secondary); }
.lang-menu {
    position: absolute; top: 100%; right: 0; background: #fff;
    border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.12);
    min-width: 120px; overflow: hidden; z-index: 200;
}
.lang-menu-item { padding: 10px 16px; cursor: pointer; font-size: 13px; }
.lang-menu-item:hover { background: #f0f5ff; }
.lang-menu-item.active { color: var(--primary); font-weight: 600; background: #e8f0fe; }

/* ===== 主内容 ===== */
.main-content { padding-top: var(--top-nav-height); min-height: 100vh; }
.page { padding: 12px; }

/* ===== 注册页 ===== */
.register-container { max-width: 400px; margin: 0 auto; padding: 20px 0; }
.register-header { text-align: center; margin-bottom: 24px; }
.register-header h2 { font-size: 22px; margin-bottom: 8px; }
.register-header p { color: var(--text-secondary); font-size: 13px; }
.form-group { margin-bottom: 16px; position: relative; }
.form-group.error input { border-color: var(--danger); }
.error-msg { color: var(--danger); font-size: 12px; margin-top: 4px; display: block; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 40px; }
.pwd-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); cursor: pointer; font-size: 16px; user-select: none; }
.captcha-group { display: flex; gap: 10px; }
.captcha-group input { flex: 1; }
.captcha-img { position: relative; flex-shrink: 0; width: 100px; height: 42px; cursor: pointer; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.captcha-img img { width: 100%; height: 100%; object-fit: cover; }
.captcha-refresh { position: absolute; bottom: 0; right: 0; background: rgba(0,0,0,.5); color: #fff; font-size: 12px; padding: 1px 5px; border-radius: 4px 0 0 0; }
.btn-register {
    width: 100%; padding: 12px; font-size: 16px; font-weight: 600;
    background: #ccc; color: #fff; border-radius: 8px; margin-top: 8px;
    transition: background .2s;
}
.btn-register.active { background: var(--primary); }
.btn-primary { padding: 12px 32px; font-size: 15px; background: var(--primary); color: #fff; border-radius: 8px; }
.register-footer { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-secondary); }

/* ===== 注册成功页 ===== */
.success-container { text-align: center; padding: 60px 20px; }
.success-icon { width: 72px; height: 72px; border-radius: 50%; background: var(--success); color: #fff; font-size: 36px; line-height: 72px; margin: 0 auto 20px; }
.success-container h2 { font-size: 20px; margin-bottom: 8px; }
.success-container p { color: var(--text-secondary); margin-bottom: 24px; }

/* ===== 首页 ===== */
.announcement-bar { background: #fff; border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; overflow: hidden; height: 40px; display: flex; align-items: center; }
.announcement-text { position: relative; white-space: nowrap; }
.announcement-text span { display: none; }
.announcement-text span.active { display: inline; color: var(--warning); font-size: 13px; }

.banner-carousel { position: relative; overflow: hidden; border-radius: 10px; margin-bottom: 12px; background: #eee; }
.banner-track { display: flex; transition: transform .3s; }
.banner-item { min-width: 100%; }
.banner-item img { width: 100%; height: 150px; object-fit: cover; display: block; }
.banner-dots { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; }
.banner-dots span { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.5); cursor: pointer; }
.banner-dots span.active { background: #fff; width: 18px; border-radius: 3px; }

.guide-entry { background: linear-gradient(135deg, #667eea, #764ba2); border-radius: 10px; padding: 14px; display: flex; align-items: center; gap: 12px; margin-bottom: 12px; color: #fff; cursor: pointer; }
.guide-icon { font-size: 32px; }
.guide-text h4 { font-size: 15px; margin-bottom: 4px; }
.guide-text p { font-size: 12px; opacity: .8; }
.guide-arrow { margin-left: auto; font-size: 24px; opacity: .7; }

.grid-menu { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.grid-item { background: #fff; border-radius: 10px; padding: 16px 8px; text-align: center; cursor: pointer; transition: transform .15s; }
.grid-item:active { transform: scale(.95); }
.grid-icon { width: 40px; height: 40px; border-radius: 10px; margin: 0 auto 8px; }
.icon-task { background: #e8f0fe url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234A90D9'%3E%3Crect x='2' y='7' width='20' height='14' rx='2'/%3E%3Cpath d='M16 21V5a2 2 0 00-2-2h-4a2 2 0 00-2 2v16'/%3E%3C/svg%3E") center/24px no-repeat; }
.icon-invite { background: #fef0e8 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23FA8C16'%3E%3Cpath d='M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 00-3-3.87M16 3.13a4 4 0 010 7.75'/%3E%3C/svg%3E") center/24px no-repeat; }
.icon-ranking { background: #fff7e8 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23FAAD14'%3E%3Cpath d='M6 9H2v12h4zM14 3h-4v18h4zM22 10h-4v11h4z'/%3E%3C/svg%3E") center/24px no-repeat; }
.icon-help { background: #e8f8e8 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2352C41A'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3' fill='none' stroke='white' stroke-width='2'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17' stroke='white' stroke-width='2'/%3E%3C/svg%3E") center/24px no-repeat; }
.grid-item span { font-size: 12px; color: var(--text); }

.marquee-section { background: #fff; border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.marquee-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.marquee-vertical { height: 200px; overflow: hidden; position: relative; }
.marquee-vertical-inner { animation: marqueeUp 20s linear infinite; }
.marquee-vertical:hover .marquee-vertical-inner { animation-play-state: paused; }
.marquee-item { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.marquee-item strong { color: var(--primary); }
@keyframes marqueeUp { 0% { transform: translateY(0); } 100% { transform: translateY(-50%); } }

.marquee-horizontal { overflow: hidden; white-space: nowrap; }
.marquee-horizontal-inner { display: inline-block; animation: marqueeRight 20s linear infinite; font-size: 13px; }
.marquee-horizontal:hover .marquee-horizontal-inner { animation-play-state: paused; }
.marquee-horizontal-inner strong { color: var(--primary); }
@keyframes marqueeRight { 0% { transform: translateX(100%); } 100% { transform: translateX(-100%); } }

/* ===== 任务大厅 ===== */
.hall-tabs { display: flex; background: #fff; border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.hall-tab { flex: 1; text-align: center; padding: 12px; font-size: 14px; font-weight: 500; cursor: pointer; color: var(--text-secondary); transition: .2s; }
.hall-tab.active { color: var(--primary); background: #e8f0fe; font-weight: 600; }

.hall-filters { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.hall-filters select, .hall-filters input { flex: 1; min-width: 80px; padding: 8px; font-size: 12px; border-radius: 6px; background: #fff; }

.hall-refresh { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.refresh-countdown { font-size: 12px; color: var(--text-secondary); min-width: 30px; }
.btn-refresh { padding: 6px 14px; background: var(--primary); color: #fff; font-size: 12px; border-radius: 6px; }
.btn-refresh:disabled { background: #ccc; }
.btn-card-pack { padding: 6px 14px; background: var(--warning); color: #fff; font-size: 12px; border-radius: 6px; margin-left: auto; }

.card-list { display: flex; flex-direction: column; gap: 10px; }
.card-item { background: #fff; border-radius: 10px; padding: 14px; border: 1px solid var(--border); }
.card-item.mine { border-color: var(--primary); border-width: 2px; background: #f8faff; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.card-title { font-size: 15px; font-weight: 600; }
.my-badge { color: var(--primary); font-size: 12px; }
.card-status { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #f0f0f0; color: var(--text-secondary); }
.card-status.active { background: #e8f8e8; color: var(--success); }
.card-body { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 10px; }
.card-info { font-size: 12px; color: var(--text-secondary); }
.card-info span { color: var(--text); }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-sm { padding: 4px 10px; font-size: 11px; border-radius: 4px; background: #f0f0f0; color: var(--text); }
.btn-sm.on { background: var(--primary); color: #fff; }
.btn-danger { background: #fff0f0; color: var(--danger); }

.bounty-list { display: flex; flex-direction: column; gap: 10px; }
.bounty-item { background: #fff; border-radius: 10px; padding: 14px; border: 1px solid var(--border); }
.bounty-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.bounty-header h4 { font-size: 15px; }
.bounty-amount { font-size: 18px; font-weight: 700; color: var(--danger); }
.bounty-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.bounty-info { font-size: 12px; color: var(--text-secondary); margin-bottom: 10px; }
.btn-accept { padding: 8px 20px; background: var(--primary); color: #fff; font-size: 13px; border-radius: 6px; }

.empty-tip { text-align: center; padding: 40px; color: var(--text-secondary); font-size: 13px; }

/* ===== 卡包管理 ===== */
.card-manage-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.btn-back { padding: 6px 12px; background: transparent; color: var(--primary); font-size: 15px; }
.btn-add { padding: 8px 16px; background: var(--primary); color: #fff; font-size: 13px; border-radius: 6px; }
.switch-label { display: flex; align-items: center; gap: 4px; font-size: 11px; cursor: pointer; }
.switch-label input { display: none; }
.switch { width: 32px; height: 18px; background: #ccc; border-radius: 9px; position: relative; transition: .2s; }
.switch::after { content: ''; width: 14px; height: 14px; background: #fff; border-radius: 50%; position: absolute; top: 2px; left: 2px; transition: .2s; }
.switch-label input:checked + .switch { background: var(--primary); }
.switch-label input:checked + .switch::after { left: 16px; }

/* ===== 排行榜 ===== */
.ranking-list { background: #fff; border-radius: 10px; overflow: hidden; }
.ranking-item { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.ranking-item.rank-1 { background: linear-gradient(90deg, #fff9e6, #fff); }
.ranking-item.rank-2 { background: linear-gradient(90deg, #f5f5f5, #fff); }
.ranking-item.rank-3 { background: linear-gradient(90deg, #fdf0e8, #fff); }
.rank-num { width: 36px; font-size: 18px; text-align: center; }
.rank-user { flex: 1; font-size: 14px; font-weight: 500; }
.rank-amount { font-size: 14px; font-weight: 600; color: var(--danger); }

/* ===== 帮助中心 ===== */
.help-list { background: #fff; border-radius: 10px; overflow: hidden; }
.help-item { display: flex; justify-content: space-between; padding: 14px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 14px; }
.help-item:active { background: #f5f5f5; }

/* ===== 邀请中心 ===== */
.invite-container { background: #fff; border-radius: 10px; padding: 20px; }
.invite-container h3 { text-align: center; margin-bottom: 20px; }
.invite-code-box, .invite-link-box { margin-bottom: 16px; }
.invite-code-box span, .invite-link-box span { font-size: 12px; color: var(--text-secondary); }
.invite-code, .invite-link { background: #f5f5f5; padding: 10px; border-radius: 6px; font-size: 16px; font-weight: 600; letter-spacing: 2px; margin: 6px 0; word-break: break-all; }
.btn-copy { margin-top: 6px; padding: 6px 14px; background: var(--primary); color: #fff; font-size: 12px; border-radius: 6px; }

/* ===== 弹窗 ===== */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.5); z-index: 300; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-content { background: #fff; border-radius: 12px; padding: 24px; width: 100%; max-width: 360px; max-height: 80vh; overflow-y: auto; }
.modal-content h3 { margin-bottom: 16px; font-size: 17px; }
.login-modal .form-group { margin-bottom: 12px; }
.login-switch { text-align: center; margin-top: 12px; font-size: 13px; color: var(--text-secondary); }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.btn-cancel { flex: 1; padding: 10px; background: #f0f0f0; color: var(--text); border-radius: 8px; }
.btn-save { flex: 1; padding: 10px; background: var(--primary); color: #fff; border-radius: 8px; }
.help-detail { max-width: 500px; }
.help-content { font-size: 14px; line-height: 1.6; margin-bottom: 16px; }
.help-content img { max-width: 100%; }

/* ===== 底部导航 ===== */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    height: var(--nav-height); background: #fff;
    display: flex; align-items: center;
    border-top: 1px solid var(--border);
    padding-bottom: var(--safe-bottom);
}
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; color: var(--text-secondary); position: relative; padding: 4px 0; }
.nav-item.active { color: var(--primary); }
.nav-item span { font-size: 10px; }
.badge { position: absolute; top: 2px; right: 50%; transform: translateX(18px); background: var(--danger); color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 8px; min-width: 16px; text-align: center; }

/* ===== 客服悬浮按钮 ===== */
.customer-service-fab {
    position: fixed; bottom: 100px; right: 16px; z-index: 200;
    width: 52px; height: 52px; border-radius: 50%;
    background: var(--primary); box-shadow: 0 4px 12px rgba(74,144,217,.4);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: transform .15s; user-select: none;
    touch-action: none;
}
.customer-service-fab:active { transform: scale(.9); }

/* ===== Toast ===== */
.toast { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); z-index: 400; padding: 10px 24px; border-radius: 20px; font-size: 13px; color: #fff; background: rgba(0,0,0,.75); animation: toastIn .3s; pointer-events: none; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ===== 其他 ===== */
.page-orders, .page-messages, .page-profile { display: flex; align-items: center; justify-content: center; min-height: 60vh; color: var(--text-secondary); font-size: 15px; }