/* ============================================================
   功能库 前台公共样式 —— 现代浅色扁平风格（与新版后台同一视觉体系）
   移动端优先
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #4f6ef7; --primary-d: #3b56d8;
  --bg:#f3f5f9; --card:#fff;
  --text:#1f2333; --muted:#8a90a6; --line:#e8ebf2;
  --ok:#22b07d; --warn:#f0a020; --err:#e5484d;
  --radius:16px; --shadow:0 2px 10px rgba(20,26,50,.05);
}
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 14px 40px; }

/* ---------- 顶部品牌栏 ---------- */
.topbar { background: linear-gradient(135deg,#4a66f0 0%, #5d7bff 55%, #6f8dff 100%); color:#fff; box-shadow:0 4px 16px rgba(79,110,247,.25); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; padding-top: 15px; padding-bottom: 15px; }
.topbar h1 { font-size: 20px; font-weight: 800; letter-spacing:.5px; }
.topbar h1 a{color:#fff;text-decoration:none;}
.topbar h1::before{content:'⚡';margin-right:2px;}
.topbar .user { font-size: 13px; display: flex; gap: 12px; align-items: center; }
.topbar a { color: #fff; opacity: .95; }
.pts-chip { background: rgba(255,255,255,.2); padding: 3px 12px; border-radius: 20px; font-weight:600; }

/* ---------- 功能导航（由后台配置，JSON） ---------- */
.nav-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0; }
.nav-grid a { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 8px 14px; text-align: center; color: var(--text); transition: .18s; box-shadow: var(--shadow); }
.nav-grid a:active, .nav-grid a:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: 0 8px 20px rgba(79,110,247,.14); }
.nav-grid .ico { font-size: 24px; display: block; margin-bottom: 6px; }
.nav-grid .lab { font-size: 13px; font-weight:600; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card h3 { font-size: 16px; margin-bottom: 12px; }
.card .list { list-style: none; }
.card .list li { padding: 13px 0; border-bottom: 1px solid var(--line); }
.card .list li:last-child { border-bottom: 0; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 13px; }
.tright { text-align: right; }
.center { text-align: center; }

/* 公告/详情/教程正文 */
.prose { white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height:1.8; }

/* ---------- 表单 ---------- */
.form-item { margin-bottom: 15px; }
.form-item label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; font-weight:600; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local], textarea, select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 15px; background:#fff; color: var(--text); outline: none; transition:.15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow:0 0 0 3px rgba(79,110,247,.12); }
textarea { min-height: 110px; resize: vertical; }

.btn { display: inline-block; border: 0; cursor: pointer; padding: 12px 20px; border-radius: 12px; font-size: 15px; font-weight: 700; text-align: center; transition:.18s; }
.btn-primary { background: linear-gradient(135deg,var(--primary),var(--primary-d)); color: #fff; width: 100%; box-shadow:0 6px 16px rgba(79,110,247,.28); }
.btn-primary:hover { transform: translateY(-1px); box-shadow:0 8px 20px rgba(79,110,247,.35); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: #eef1fb; color: var(--primary); }
.btn-danger { background: var(--err); color: #fff; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; display: block; }
.gap { height: 12px; }

/* ---------- 提示 ---------- */
.alert { padding: 12px 15px; border-radius: 12px; font-size: 14px; margin-bottom: 14px; }
.alert-success { background: #e7f7ef; color: #177d5a; }
.alert-error { background: #fdecec; color: #b03438; }

/* ---------- 徽章 ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight:600; }
.badge-ok { background: #e7f7ef; color: #177d5a; }
.badge-warn { background: #fdf3e3; color: #b07a15; }
.badge-err { background: #fdecec; color: #b03438; }
.badge-info { background: #e8eeff; color: var(--primary-d); }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; }

/* ---------- 排行榜 ---------- */
.rank-item { display: flex; align-items: center; gap: 13px; padding: 13px 4px; border-bottom: 1px solid var(--line); }
.rank-item .no { width: 32px; height: 32px; line-height: 32px; text-align: center; border-radius: 50%; background: #eef1fb; color: var(--muted); font-weight: 800; flex:none; font-size:14px; }
.rank-item .no.top1 { background: linear-gradient(135deg,#ffd76a,#f5a623); color:#fff; box-shadow:0 3px 8px rgba(245,166,35,.4); }
.rank-item .no.top2 { background: #d8dde8; color:#555; }
.rank-item .no.top3 { background: #f0c9a0; color:#7a4a12; }
.rank-item .qq { flex: 1; }
.rank-item .pts { font-weight: 800; color: var(--primary); }

/* ---------- 聊天 ---------- */
.chat-box { height: 54vh; overflow-y: auto; background: #f8f9fc; border: 1px solid var(--line); border-radius: 14px; padding: 13px; margin-bottom: 12px; }
.chat-line { margin-bottom: 12px; }
.chat-line .head { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.chat-line .bubble { display: inline-block; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; font-size: 14px; max-width: 85%; word-break: break-word; box-shadow: 0 1px 3px rgba(20,26,50,.06); }
.chat-line.me { text-align: right; }
.chat-line.me .bubble { background: linear-gradient(135deg,var(--primary),var(--primary-d)); color: #fff; border-color: transparent; }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; }

/* ---------- 页脚 ---------- */
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 26px 0 12px; }

/* ---------- 列表条目（公告/详情/教程/反馈） ---------- */
.list a { font-weight:600; }
.list li code{ background:#eef1fb; color:var(--primary-d); padding:2px 6px; border-radius:6px; font-size:12px; }

/* 管理后台用到的公共组件（兼容） */
.admin-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.admin-grid a { background: var(--card); border:1px solid var(--line); border-radius: 12px; padding: 16px 8px; text-align:center; color:var(--text); }
.admin-grid .ico{font-size:20px;display:block;margin-bottom:4px;}
.admin-grid .lab{font-size:13px;}
@media(min-width:600px){ .admin-grid{grid-template-columns:repeat(4,1fr);} }
.ops a, .ops button { margin-right: 6px; }

/* ---------- 首页：品牌 Hero ---------- */
.hero{position:relative;overflow:hidden;border-radius:20px;margin:16px 0 16px;background:linear-gradient(135deg,#4a66f0 0%,#5d7bff 60%,#6f8dff 100%);color:#fff;box-shadow:0 10px 28px rgba(79,110,247,.30);padding:26px 22px;}
.hero::after{content:'';position:absolute;right:-40px;top:-40px;width:180px;height:180px;border-radius:50%;background:rgba(255,255,255,.14);}
.hero::before{content:'';position:absolute;right:60px;bottom:-70px;width:140px;height:140px;border-radius:50%;background:rgba(255,255,255,.10);}
.hero-inner{position:relative;z-index:1;}
.hero-tag{display:inline-block;background:rgba(255,255,255,.2);color:#fff;font-size:12px;font-weight:700;padding:3px 12px;border-radius:20px;margin-bottom:10px;letter-spacing:.5px;}
.hero h2{font-size:22px;font-weight:800;margin-bottom:6px;line-height:1.3;}
.hero-sub{font-size:13px;opacity:.96;margin-bottom:14px;}
.hero-sub .badge{margin-left:4px;}
.hero-cta{display:flex;gap:10px;flex-wrap:wrap;}
.hero-cta .btn{width:auto;}
.hero-notice{margin-top:14px;background:rgba(255,255,255,.16);border-radius:12px;padding:9px 13px;font-size:13px;line-height:1.6;}

/* ---------- 首页：我的数据条 ---------- */
.stat-strip{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:18px;}
.stat-strip .stat-cell{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:13px 10px;text-align:center;box-shadow:var(--shadow);}
.stat-strip .v{font-size:20px;font-weight:800;color:var(--primary);line-height:1.2;}
.stat-strip .k{font-size:12px;color:var(--muted);margin-top:3px;}
@media(max-width:520px){ .stat-strip{grid-template-columns:repeat(2,1fr);} }

/* ---------- 首页：板块标题 ---------- */
.section-head{display:flex;align-items:baseline;justify-content:space-between;margin:4px 2px 10px;}
.section-head h3{font-size:16px;font-weight:800;}
.section-head .sub{font-size:12px;color:var(--muted);}
.section-head .more{font-size:13px;color:var(--primary);}

/* ---------- 首页：公告列表 ---------- */
.news-item{display:flex;align-items:center;gap:12px;padding:13px 4px;border-bottom:1px solid var(--line);color:var(--text);text-decoration:none;}
.news-item:last-child{border-bottom:0;}
.news-item .n-body{flex:1;min-width:0;}
.news-item .n-title{font-weight:700;font-size:14px;}
.news-item .n-excerpt{font-size:12px;color:var(--muted);margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.news-item .n-date{flex:none;background:#eef1fb;color:var(--primary-d);font-size:11px;font-weight:600;padding:3px 9px;border-radius:12px;}

/* ---------- 首页：分栏卡片 ---------- */
.flex-card{flex:1;min-width:240px;display:flex;flex-direction:column;}
.flex-card .btn{margin-top:auto;}

/* 窄屏适配 */
@media(max-width:560px){
  .nav-grid { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 15px; }
}
