* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif; background: #f5f7fa; color: #333; font-size: 14px; }
a { text-decoration: none; color: inherit; }
input, button { border: none; outline: none; font-family: inherit; }

:root {
    --primary: #10b981;
    --primary-light: #34d399;
    --primary-dark: #059669;
    --text-main: #1f2937;
    --text-sub: #6b7280;
    --bg-page: #f5f7fa;
    --bg-card: #fff;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
}

#app { height: 100vh; display: flex; flex-direction: column; overflow: hidden; position: relative; }

/* 页面容器 */
#pages { flex: 1; position: relative; overflow: hidden; }
.page { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; background: var(--bg-page); transform: translateX(100%); transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1); opacity: 0; pointer-events: none; }
.page.page-active { transform: translateX(0); opacity: 1; pointer-events: auto; }
.page.page-left { transform: translateX(-30%); opacity: 0.3; }

/* 子页面（详情类） */
.sub-page { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #fff; z-index: 100; transform: translateX(100%); transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1); display: flex; flex-direction: column; }
.sub-page.show { transform: translateX(0); }

.sub-header { height: 48px; display: flex; align-items: center; padding: 0 12px; background: #fff; border-bottom: 1px solid #f0f0f0; position: relative; flex-shrink: 0; }
.back-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; font-size: 24px; color: #333; cursor: pointer; }
.sub-title { position: absolute; left: 50%; transform: translateX(-50%); font-size: 16px; font-weight: 500; }
.sub-content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* 顶部导航 */
.page-header { height: 52px; background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; display: flex; align-items: center; padding: 0 16px; flex-shrink: 0; position: relative; }
.header-title { font-size: 18px; font-weight: 600; }
.header-search { margin-left: auto; background: rgba(255,255,255,0.25); padding: 6px 14px; border-radius: 20px; font-size: 13px; }

.page-content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 60px; }

/* Banner */
.banner-wrap { position: relative; margin: 12px; border-radius: var(--radius); overflow: hidden; height: 140px; background: #e5e7eb; box-shadow: var(--shadow); }
.banner-list { display: flex; height: 100%; transition: transform 0.5s ease; }
.banner-item { min-width: 100%; height: 100%; background: linear-gradient(135deg, var(--primary-light), var(--primary)); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; font-weight: 500; }
.banner-dots { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; }
.banner-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.5); transition: all 0.3s; }
.banner-dot.active { width: 16px; border-radius: 3px; background: #fff; }

/* 快捷分类 */
.quick-cate { display: flex; justify-content: space-around; padding: 16px 12px; background: #fff; margin: 0 12px 12px; border-radius: var(--radius); box-shadow: var(--shadow); }
.cate-item { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.cate-icon { width: 44px; height: 44px; border-radius: 50%; background: #ecfdf5; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.cate-item span { font-size: 13px; color: var(--text-main); }

/* 区块 */
.section { margin-bottom: 16px; padding: 0 12px; }
.section-title { padding: 8px 4px 12px; font-size: 16px; font-weight: 600; color: var(--text-main); display: flex; justify-content: space-between; align-items: center; }

/* 课程卡片 - 横向滚动 */
.course-list-h { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.course-list-h::-webkit-scrollbar { display: none; }
.course-card-h { flex-shrink: 0; width: 150px; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); cursor: pointer; transition: transform 0.2s; }
.course-card-h:active { transform: scale(0.97); }
.course-cover-h { width: 100%; height: 90px; background: linear-gradient(135deg, #a7f3d0, #6ee7b7); display: flex; align-items: center; justify-content: center; font-size: 32px; }
.course-info-h { padding: 8px 10px; }
.course-title-h { font-size: 13px; color: var(--text-main); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; height: 36px; }
.course-price-h { margin-top: 6px; color: var(--primary); font-weight: 600; font-size: 14px; }

/* 课程列表 - 竖向 */
.course-list { display: flex; flex-direction: column; gap: 10px; }
.course-card { display: flex; background: #fff; border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); cursor: pointer; transition: transform 0.2s; }
.course-card:active { transform: scale(0.98); }
.course-cover { width: 110px; height: 75px; border-radius: 8px; background: linear-gradient(135deg, #a7f3d0, #6ee7b7); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 28px; }
.course-info { flex: 1; margin-left: 12px; display: flex; flex-direction: column; justify-content: space-between; }
.course-title { font-size: 14px; color: var(--text-main); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.course-bottom { display: flex; justify-content: space-between; align-items: center; }
.course-price { color: var(--primary); font-weight: 600; font-size: 15px; }
.course-price::before { content: '¥'; font-size: 12px; }
.course-count { font-size: 12px; color: var(--text-sub); }

/* 分类页 */
.cate-tabs { display: flex; background: #fff; padding: 0 12px; border-bottom: 1px solid #f0f0f0; position: sticky; top: 0; z-index: 10; }
.cate-tab { flex: 1; text-align: center; padding: 14px 0; font-size: 14px; color: var(--text-sub); position: relative; cursor: pointer; transition: color 0.3s; }
.cate-tab.active { color: var(--primary); font-weight: 500; }
.cate-tab.active::after { content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 24px; height: 3px; background: var(--primary); border-radius: 2px; }
.cate-course-list { padding: 12px; }

/* 个人中心 */
.user-header { background: linear-gradient(135deg, var(--primary), var(--primary-light)); padding: 30px 20px 40px; color: #fff; flex-shrink: 0; }
.user-info { display: flex; align-items: center; cursor: pointer; }
.user-avatar { width: 56px; height: 56px; border-radius: 50%; background: rgba(255,255,255,0.3); display: flex; align-items: center; justify-content: center; font-size: 28px; }
.user-text { margin-left: 14px; }
.user-name { font-size: 17px; font-weight: 600; }
.user-phone { font-size: 13px; opacity: 0.85; margin-top: 4px; }

.user-menu { background: #fff; border-radius: var(--radius); margin: 12px; overflow: hidden; box-shadow: var(--shadow); }
.menu-item { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid #f5f5f5; cursor: pointer; transition: background 0.2s; }
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: #f9fafb; }
.menu-icon { width: 24px; font-size: 18px; margin-right: 12px; text-align: center; }
.menu-item span:nth-child(2) { flex: 1; font-size: 14px; color: var(--text-main); }
.menu-arrow { color: #ccc; font-size: 18px; }

.logout-btn { margin: 24px 12px; background: #fff; color: #ef4444; text-align: center; padding: 14px; border-radius: var(--radius); font-size: 15px; cursor: pointer; box-shadow: var(--shadow); }

/* 底部Tab */
.tab-bar { height: 56px; display: flex; background: #fff; border-top: 1px solid #eee; flex-shrink: 0; padding-bottom: env(safe-area-inset-bottom); }
.tab-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #9ca3af; cursor: pointer; transition: color 0.25s; }
.tab-item.active { color: var(--primary); }
.tab-icon { font-size: 22px; line-height: 1; }
.tab-item span { font-size: 11px; }

/* 弹窗 */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000; display: none; }
.modal.show { display: block; }
.modal-mask { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); animation: fadeIn 0.3s; }
.modal-content { position: absolute; bottom: 0; left: 0; width: 100%; background: #fff; border-radius: 20px 20px 0 0; padding: 24px 20px 30px; animation: slideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1); }
.modal-close { position: absolute; top: 16px; right: 16px; font-size: 24px; color: #999; cursor: pointer; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; }

.login-title { font-size: 20px; font-weight: 600; text-align: center; margin-bottom: 6px; }
.login-tip { text-align: center; color: var(--text-sub); font-size: 12px; margin-bottom: 24px; }

.form-item { margin-bottom: 14px; }
.form-item input { width: 100%; height: 46px; border: 1px solid #e5e7eb; border-radius: 10px; padding: 0 14px; font-size: 15px; transition: border-color 0.3s; }
.form-item input:focus { border-color: var(--primary); }
.code-item { display: flex; gap: 10px; }
.code-item input { flex: 1; }
.code-btn { width: 110px; height: 46px; background: #ecfdf5; color: var(--primary); border-radius: 10px; font-size: 13px; cursor: pointer; flex-shrink: 0; }
.code-btn:disabled { color: #999; background: #f3f4f6; }

.agree-box { font-size: 12px; color: var(--text-sub); margin-bottom: 18px; }
.agree-box a { color: var(--primary); }
.agree-box input { margin-right: 4px; vertical-align: middle; }

.login-btn { width: 100%; height: 46px; background: var(--primary); color: #fff; border-radius: 10px; font-size: 16px; font-weight: 500; cursor: pointer; transition: background 0.3s; }
.login-btn:active { background: var(--primary-dark); }

.wechat-login { text-align: center; margin-top: 20px; color: var(--primary); font-size: 14px; cursor: pointer; }
.wx-icon { margin-right: 4px; }

/* 课程详情 */
.course-detail-cover { width: 100%; height: 200px; background: linear-gradient(135deg, #a7f3d0, #6ee7b7); display: flex; align-items: center; justify-content: center; font-size: 64px; }
.course-detail-body { padding: 16px; }
.course-detail-title { font-size: 18px; font-weight: 600; line-height: 1.5; color: var(--text-main); }
.course-detail-price { margin-top: 12px; color: var(--primary); font-size: 22px; font-weight: 700; }
.course-detail-price::before { content: '¥'; font-size: 14px; }
.course-detail-desc { margin-top: 16px; color: var(--text-sub); line-height: 1.7; font-size: 14px; }

.detail-section { margin-top: 20px; }
.detail-section-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; padding-left: 8px; border-left: 3px solid var(--primary); }

.chapter-item { background: #f9fafb; border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
.chapter-title { padding: 12px 14px; font-weight: 500; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.chapter-lessons { display: none; background: #fff; }
.chapter-lessons.show { display: block; }
.lesson-item { padding: 12px 14px 12px 28px; border-top: 1px solid #f5f5f5; font-size: 13px; color: var(--text-sub); display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.lesson-item:hover { background: #f9fafb; }
.lesson-free { color: var(--primary); font-size: 11px; border: 1px solid var(--primary); padding: 1px 5px; border-radius: 3px; }

.detail-bottom { position: fixed; bottom: 0; left: 0; width: 100%; background: #fff; padding: 10px 16px; display: flex; align-items: center; gap: 12px; border-top: 1px solid #eee; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.detail-fav { width: 44px; height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 20px; color: #999; cursor: pointer; }
.detail-fav.active { color: #ef4444; }
.detail-fav span { font-size: 10px; margin-top: 2px; }
.buy-btn { flex: 1; height: 42px; background: var(--primary); color: #fff; border-radius: 21px; font-size: 15px; font-weight: 500; cursor: pointer; }
.buy-btn:active { background: var(--primary-dark); }

/* 播放器 */
.player-box { width: 100%; aspect-ratio: 16/9; background: #000; }
.lesson-list { padding: 12px; }
.lesson-progress { height: 3px; background: #e5e7eb; border-radius: 2px; overflow: hidden; margin-top: 4px; }
.lesson-progress-bar { height: 100%; background: var(--primary); transition: width 0.3s; }

/* 动画 */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* PC端适配 */
@media (min-width: 768px) {
    #app { max-width: 480px; margin: 0 auto; box-shadow: 0 0 30px rgba(0,0,0,0.1); }
    .banner-wrap { height: 180px; }
}