/* ===== 移动端 H5 基础样式 ===== */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --accent: #f59e0b;
    --bg: #f5f6fa;
    --card: #ffffff;
    --text: #1f2330;
    --muted: #8a90a2;
    --line: #ececf1;
    --danger: #ef4444;
    --success: #10b981;
    --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.app { min-height: 100vh; display: flex; flex-direction: column; }
.app-header {
    position: sticky; top: 0; z-index: 50;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.logo { font-size: 20px; font-weight: 800; letter-spacing: 1px; }
.header-right { display: flex; align-items: center; gap: 10px; }
.btn-link { color: #fff; padding: 5px 12px; border: 1px solid rgba(255,255,255,.5); border-radius: 20px; font-size: 13px; }
.btn-link.primary { background: #fff; color: var(--primary); border-color: #fff; font-weight: 600; }
.avatar-link { display: flex; align-items: center; gap: 6px; color: #fff; font-size: 13px; }
.avatar-sm { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.7); }

.app-main { flex: 1; padding-bottom: 70px; }
.app-main.no-nav { padding-bottom: 0; }

.app-tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    display: flex; background: #fff; border-top: 1px solid var(--line);
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.app-tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 11px; }
.app-tabbar a .ico { font-size: 20px; line-height: 1; }
.app-tabbar a.active { color: var(--primary); font-weight: 600; }

.container { padding: 14px 14px 20px; }
.card { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; box-shadow: 0 2px 10px rgba(0,0,0,.03); }
.section-title { font-size: 17px; font-weight: 700; margin: 6px 0 12px; display: flex; align-items: center; justify-content: space-between; }
.section-title .more { font-size: 12px; color: var(--muted); font-weight: 400; }

/* 按钮 */
.btn { display: inline-block; padding: 11px 18px; border-radius: 24px; border: none; background: var(--primary); color: #fff; font-size: 15px; font-weight: 600; text-align: center; cursor: pointer; width: 100%; }
.btn:active { transform: scale(.98); }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.accent { background: var(--accent); }
.btn.sm { padding: 6px 14px; font-size: 13px; width: auto; }
.btn:disabled { opacity: .5; }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input, .textarea, select.input {
    width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
    font-size: 15px; background: #fafbff; outline: none; transition: border .2s;
}
.input:focus, .textarea:focus { border-color: var(--primary); background: #fff; }
.textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* 课程卡片 */
.course-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.course-card { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.course-cover { width: 100%; aspect-ratio: 16/10; object-fit: cover; background: #eef; }
.course-body { padding: 10px; }
.course-title { font-size: 14px; font-weight: 600; margin: 0 0 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.course-meta { display: flex; align-items: center; justify-content: space-between; }
.price { color: var(--danger); font-weight: 700; font-size: 15px; }
.price.free { color: var(--success); }
.teacher { font-size: 12px; color: var(--muted); }

/* 徽标 */
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; background: #eef0ff; color: var(--primary); margin-right: 6px; }
.tag.gray { background: #f0f1f5; color: var(--muted); }
.tag.hot { background: #fff1e6; color: #f97316; }

/* 进度条 */
.progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); }

/* 列表 */
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: none; }
.list-item .thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: #eef; flex: none; }
.list-item .info { flex: 1; min-width: 0; }
.list-item .info h4 { margin: 0 0 4px; font-size: 14px; }
.list-item .sub { font-size: 12px; color: var(--muted); }

/* 搜索栏 */
.search-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.search-bar input { flex: 1; }

/* 封面大图 */
.hero { position: relative; border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; aspect-ratio: 16/9; background: linear-gradient(135deg,#667eea,#764ba2); display:flex; align-items:flex-end; }
.hero img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.hero .hero-text { position: relative; padding: 14px; color:#fff; width:100%; background: linear-gradient(transparent, rgba(0,0,0,.55)); }
.hero .hero-text h2 { margin:0; font-size:18px; }

/* 提示 */
.alert { padding: 10px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 12px; }
.alert.error { background: #fee2e2; color: #b91c1c; }
.alert.success { background: #dcfce7; color: #15803d; }
.alert.info { background: #e0e7ff; color: #3730a3; }

/* 直播 */
.live-room { background: #111; color:#fff; min-height: 100vh; }
.video-placeholder { aspect-ratio: 16/9; background: radial-gradient(circle at 50% 40%, #3b3b5c, #111); display:flex; align-items:center; justify-content:center; font-size: 48px; position: relative; }
.live-badge { position:absolute; top:10px; left:10px; background: var(--danger); color:#fff; padding:3px 10px; border-radius: 12px; font-size:12px; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
.danmaku-layer { position:absolute; inset:0; overflow:hidden; pointer-events:none; }
.danmaku { position:absolute; white-space:nowrap; color:#fff; font-size:14px; text-shadow:0 1px 2px #000; }
.chat-box { background:#1a1a1a; height: 40vh; overflow-y:auto; padding: 10px; }
.chat-msg { margin-bottom: 8px; font-size: 14px; }
.chat-msg .name { color: #7dd3fc; margin-right: 6px; }
.live-tools { display:flex; gap:8px; padding:10px; background:#1a1a1a; }
.live-tools .btn { width:auto; flex:1; padding:8px; font-size:13px; border-radius:12px; }

/* 空状态 */
.empty { text-align:center; color: var(--muted); padding: 40px 0; }

/* 通用工具 */
.mt-0{margin-top:0}.mt-2{margin-top:8px}.mt-3{margin-top:14px}
.flex{display:flex}.between{justify-content:space-between}.center{align-items:center}
.muted{color:var(--muted)}.small{font-size:12px}.bold{font-weight:700}
.text-right{text-align:right}
.points-badge{background:#fff7e6;color:#d97706;padding:2px 10px;border-radius:12px;font-size:12px;font-weight:600}
