/* ============================================================
   学员端 H5 公共样式 · 双主题 token 系统 (light 白天 / dark 夜间)
   切换: localStorage 'theme' / URL ?theme= / 页面内 .theme-toggle 按钮
   主题初始化逻辑见 app.js initTheme()
   ============================================================ */
:root {
  /* 品牌色(两主题共用) */
  --brand-1: #ff7a45;
  --brand-2: #ff4d4f;
  --brand-grad: linear-gradient(135deg, #ff7a45, #ff4d4f);
  --brand-soft: #fff1e8;

  /* 白天(默认) */
  --bg: #f5f6f8;
  --card: #ffffff;
  --card2: #f2f3f5;
  --card-soft: #fff9f4;
  --txt: #1d2129;
  --txt2: #7a8190;
  --txt3: #9aa0ab;
  --line: #eceef1;
  --line-strong: #dfe2e8;
  --input-bg: #fafbfc;
  --shadow: 0 4px 18px rgba(31, 35, 45, .06);
  --shadow-lg: 0 10px 30px rgba(31, 35, 45, .10);

  --ok-bg: #e6f7ee;   --ok-fg: #10a54a;
  --lock-bg: #f0f1f3; --lock-fg: #9aa0ab;
  --finish-bg: #fff3e8; --finish-fg: #ff7a45;
  --free-bg: #edf4ff; --free-fg: #3b82f6;
  --danger: #ff4d4f;
  --live-dot: #ff4d4f;
}
[data-theme="dark"] {
  --bg: #0e0f13;
  --card: #1a1c22;
  --card2: #23262e;
  --card-soft: #1f2420;
  --txt: #f1f2f5;
  --txt2: #a2a8b3;
  --txt3: #6b7180;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .14);
  --input-bg: #23262e;
  --shadow: 0 4px 18px rgba(0, 0, 0, .35);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);

  --ok-bg: rgba(16, 165, 74, .18);   --ok-fg: #3ddc84;
  --lock-bg: rgba(255, 255, 255, .08); --lock-fg: #6b7180;
  --finish-bg: rgba(255, 122, 69, .18); --finish-fg: #ffa270;
  --free-bg: rgba(59, 130, 246, .18); --free-fg: #7cb3ff;
  --danger: #ff4d4f;
  --live-dot: #ff4d4f;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--txt); font-size: 15px; line-height: 1.6;
  max-width: 640px; margin: 0 auto; min-height: 100vh; padding-bottom: 70px;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}

/* ---------- 导航条 ---------- */
.navbar {
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(135deg, #2a2d38, #1b1d24);
  color: #fff; padding: 13px 16px; font-size: 17px; font-weight: 600;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
[data-theme="light"] .navbar { background: var(--brand-grad); }
.navbar .nav-title { flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navbar .side { width: 74px; flex-shrink: 0; }
.navbar .side.left { text-align: left; }
.navbar .side.right { text-align: right; }
.navbar .back { cursor: pointer; font-weight: 400; font-size: 14px; opacity: .92; display: inline-block; }

/* ---------- 主题切换按钮 ---------- */
.theme-toggle {
  border: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--card2); color: var(--txt2); font-size: 16px; line-height: 1;
  transition: transform .2s ease, background .2s ease; vertical-align: middle;
}
.theme-toggle:active { transform: scale(.88); }
.navbar .theme-toggle { background: rgba(255, 255, 255, .18); color: #fff; backdrop-filter: blur(4px); }
.theme-toggle.fixed {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); right: 14px; z-index: 60;
  background: rgba(30, 32, 40, .55); color: #fff; backdrop-filter: blur(6px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border-radius: 18px; margin: 12px; padding: 18px 16px;
  box-shadow: var(--shadow); transition: background .25s ease, box-shadow .25s ease;
  border: 1px solid transparent;
}
.card + .card { margin-top: 12px; }

/* ---------- 按钮 ---------- */
.btn {
  display: block; width: 100%; border: none; border-radius: 14px; padding: 14px;
  background: var(--brand-grad); color: #fff; font-size: 16px; font-weight: 600; cursor: pointer;
  box-shadow: 0 6px 16px rgba(255, 77, 79, .22); transition: opacity .15s ease, transform .1s ease;
}
.btn:active { opacity: .85; transform: scale(.985); }
.btn.ghost { background: var(--card); color: var(--brand-2); border: 1px solid var(--line-strong); box-shadow: none; }
.btn.plain { background: var(--card2); color: var(--txt2); box-shadow: none; font-weight: 500; }
.btn:disabled { opacity: .5; }

/* ---------- 输入框 ---------- */
input, textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 12px; padding: 13px 14px;
  font-size: 15px; outline: none; background: var(--input-bg); color: var(--txt);
  margin-bottom: 14px; transition: border-color .2s ease, background .2s ease;
}
input:focus, textarea:focus { border-color: var(--brand-2); background: var(--card); }
input::placeholder, textarea::placeholder { color: var(--txt3); }
label { display: block; font-size: 13px; color: var(--txt2); margin-bottom: 6px; }

/* ---------- 徽章 / 标签 ---------- */
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 20px; line-height: 1.7; font-weight: 500; }
.tag.ok    { background: var(--ok-bg); color: var(--ok-fg); }
.tag.lock  { background: var(--lock-bg); color: var(--lock-fg); }
.tag.finish{ background: var(--finish-bg); color: var(--finish-fg); }
.tag.free  { background: var(--free-bg); color: var(--free-fg); }

/* ---------- 进度条 / 进度环 ---------- */
.progress-bar { background: var(--lock-bg); border-radius: 20px; height: 8px; overflow: hidden; }
.progress-bar .inner { height: 100%; background: var(--brand-grad); border-radius: 20px; transition: width .3s; }
.ring { --p: 0; --r: 46px; width: calc(var(--r) * 2); height: calc(var(--r) * 2); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; position: relative; flex-shrink: 0;
  background: conic-gradient(var(--brand-2) calc(var(--p) * 1%), var(--lock-bg) 0); }
.ring::before { content: ''; position: absolute; inset: 8px; border-radius: 50%; background: var(--card); }
.ring .ring-txt { position: relative; z-index: 1; font-size: 15px; font-weight: 700; color: var(--txt); line-height: 1.1; text-align: center; }
.ring .ring-txt small { display: block; font-size: 10px; font-weight: 400; color: var(--txt3); }

/* ---------- 课程节条目 ---------- */
.lesson-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 2px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.lesson-item:last-child { border-bottom: none; }
.lesson-item .left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.lesson-item .num {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.lesson-item.unlocked .num { background: var(--finish-bg); color: var(--brand-2); }
.lesson-item.locked .num { background: var(--lock-bg); color: var(--txt3); }
.lesson-item .title { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-item.locked .title { color: var(--txt3); }
.lesson-item .sub { font-size: 12px; color: var(--txt3); }
.lesson-item .play-ico { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-grad); color: #fff; font-size: 13px; box-shadow: 0 4px 10px rgba(255,77,79,.25); }
.lesson-item .play-ico.lock { background: var(--lock-bg); color: var(--txt3); box-shadow: none; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; max-width: 640px; margin: 0 auto;
  background: var(--card); display: flex; border-top: 1px solid var(--line); z-index: 30;
  padding-bottom: env(safe-area-inset-bottom); transition: background .25s ease;
}
.tabbar a { flex: 1; text-align: center; padding: 8px 0 6px; color: var(--txt3); text-decoration: none; font-size: 12px; transition: color .2s; }
.tabbar a.active { color: var(--brand-2); font-weight: 600; }
.tabbar .icon { font-size: 20px; display: block; }

/* ---------- 通用 ---------- */
.empty { text-align: center; color: var(--txt3); padding: 60px 0; font-size: 14px; }
.toast {
  position: fixed; top: 45%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, .78); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; z-index: 99; max-width: 80%; text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3); backdrop-filter: blur(4px);
}
.toast.hide { display: none; }
.lock-tip { text-align: center; color: var(--txt3); font-size: 12px; padding-top: 8px; }
.countdown { color: var(--brand-2); font-weight: 600; font-variant-numeric: tabular-nums; }
video { width: 100%; background: #000; display: block; }
notice-box { display: block; }
a { color: inherit; }
strong { color: var(--txt); }

/* ---------- 微信登录按钮 ---------- */
.btn-wechat {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; border: none; border-radius: 14px; padding: 13px;
  background: #07c160; color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
  box-shadow: 0 6px 16px rgba(7, 193, 96, .22); transition: opacity .15s ease, transform .1s ease;
}
.btn-wechat:active { opacity: .9; transform: scale(.985); }
.btn-wechat .wx-ico { width: 22px; height: 22px; }
.btn-wechat .wx-ico svg { display: block; width: 100%; height: 100%; fill: #fff; }

/* ---------- 抖音风登录页 ---------- */
.login-douyin { min-height: 100vh; display: flex; flex-direction: column; position: relative; z-index: 1; }
.login-douyin .hero {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 32px; text-align: center;
}
.login-douyin .hero .circle {
  width: 88px; height: 88px; border-radius: 28px; margin-bottom: 22px;
  background: var(--brand-grad); display: flex; align-items: center; justify-content: center;
  font-size: 42px; box-shadow: 0 16px 40px rgba(255, 77, 79, .28);
}
.login-douyin .hero h1 { font-size: 28px; font-weight: 800; letter-spacing: 1px; margin-bottom: 6px; }
.login-douyin .hero p { color: var(--txt3); font-size: 14px; }
.login-douyin .form { padding: 0 28px 24px; }
.login-douyin .form input {
  border-radius: 14px; padding: 15px 16px; font-size: 16px; margin-bottom: 16px;
  background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.login-douyin .form input:focus { border-color: var(--brand-2); background: var(--card); }
.login-douyin .extras input { box-shadow: none; border: none; background: transparent; margin: 0; padding: 0; }
.login-douyin .form .btn { border-radius: 100px; padding: 16px; font-size: 17px; letter-spacing: 2px; }
.login-douyin .form .btn:disabled { opacity: .55; }
.login-douyin .extras { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--txt3); padding: 4px 4px 18px; }
.login-douyin .extras a { color: var(--brand-2); text-decoration: none; }
.login-douyin .divider {
  display: flex; align-items: center; gap: 12px; color: var(--txt3); font-size: 12px;
  padding: 0 28px 18px;
}
.login-douyin .divider::before, .login-douyin .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.login-douyin .wx-area { padding: 0 28px 22px; }
.login-douyin .first-tip {
  text-align: center; font-size: 12px; color: var(--txt3); padding: 0 28px 24px;
}
.login-douyin .first-tip a { color: var(--brand-2); text-decoration: none; }
.login-douyin .agree {
  display: flex; align-items: flex-start; gap: 8px; padding: 0 28px 22px;
  font-size: 12px; color: var(--txt3); line-height: 1.5;
}
.login-douyin .agree input { width: 16px; height: 16px; margin: 0; flex-shrink: 0; accent-color: var(--brand-2); }
.login-douyin .agree a { color: var(--brand-2); }

/* ---------- 微信绑定页 ---------- */
.bind-page { min-height: 100vh; display: flex; flex-direction: column; }
.bind-page .bind-hero {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 32px; text-align: center;
}
.bind-page .bind-hero .wx-big { width: 80px; height: 80px; border-radius: 24px; background: #07c160; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 40px; margin-bottom: 18px; }
.bind-page .bind-hero h2 { font-size: 22px; margin-bottom: 6px; }
.bind-page .bind-hero p { color: var(--txt3); font-size: 14px; }
.bind-page .bind-form { padding: 0 28px 28px; }
.bind-page .bind-form input { border-radius: 14px; padding: 15px 16px; font-size: 16px; margin-bottom: 16px; border: 1px solid transparent; }
.bind-page .bind-form input:focus { border-color: var(--brand-2); background: var(--card); }
.bind-page .bind-form .btn { border-radius: 100px; padding: 16px; font-size: 17px; letter-spacing: 2px; }
.bind-page .bind-tip { text-align: center; font-size: 12px; color: var(--txt3); padding: 0 28px 22px; }

/* 富文本内容展示(简介/课节说明) */
.rich-view { line-height: 1.85; word-break: break-word; }
.rich-view p { margin: 0 0 8px; }
.rich-view h2 { font-size: 17px; margin: 12px 0 8px; color: var(--txt1); }
.rich-view h3 { font-size: 15px; margin: 10px 0 6px; color: var(--txt1); }
.rich-view ul, .rich-view ol { padding-left: 22px; margin: 0 0 8px; }
.rich-view li { margin-bottom: 3px; }
.rich-view img { max-width: 100%; border-radius: 10px; margin: 4px 0; }
.rich-view a { color: var(--brand-2); }
.rich-view blockquote { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--brand-2); background: var(--bg2); border-radius: 0 8px 8px 0; }
.rich-view strong { color: var(--txt1); }
