/* 弓老师课程平台 H5 —— 移动端优先，微信内浏览器风格 */
:root {
  --brand: #2f6df0;
  --brand-deep: #1f55c8;
  --accent: #ff7a3d;
  --ink: #1d2129;
  --ink-2: #4e5969;
  --ink-3: #86909c;
  --line: #ececf0;
  --bg: #f5f6f8;
  --card: #ffffff;
  --ok: #00b96b;
  --lock: #c9cdd4;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(20, 30, 60, 0.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.wrap { max-width: 720px; margin: 0 auto; padding-bottom: 40px; }

/* 顶部条 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,0.92); backdrop-filter: blur(8px);
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.topbar .back { font-size: 20px; color: var(--ink-2); padding: 2px 6px; margin-left: -6px; }
.topbar h1 { font-size: 17px; font-weight: 600; margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .me { font-size: 12px; color: var(--ink-3); white-space: nowrap; }

/* 首页 hero */
.hero { padding: 22px 16px 8px; }
.hero h2 { font-size: 22px; margin: 0 0 4px; letter-spacing: 0.5px; }
.hero p { margin: 0; color: var(--ink-3); font-size: 13px; }

/* 课程卡片列表 */
.list { padding: 12px 16px; display: grid; gap: 14px; }
.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .12s ease; cursor: pointer;
}
.card:active { transform: scale(0.985); }
.card .cover { position: relative; aspect-ratio: 75/42; background: #e9edf5; }
.card .cover img { width: 100%; height: 100%; object-fit: cover; }
.card .tag {
  position: absolute; left: 10px; top: 10px;
  background: rgba(0,0,0,0.32); color: #fff; font-size: 12px;
  padding: 2px 10px; border-radius: 20px;
}
.card .lockbadge {
  position: absolute; right: 10px; top: 10px;
  font-size: 12px; padding: 3px 10px; border-radius: 20px; font-weight: 600;
  display: flex; align-items: center; gap: 4px;
}
.lockbadge.unlocked { background: rgba(0,185,107,0.16); color: #009a5a; }
.lockbadge.locked { background: rgba(0,0,0,0.32); color: #fff; }
.card .body { padding: 12px 14px 14px; }
.card .body h3 { font-size: 17px; margin: 0 0 6px; font-weight: 600; }
.card .body .sum { color: var(--ink-2); font-size: 13px; margin: 0 0 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { display: flex; align-items: center; gap: 14px; color: var(--ink-3); font-size: 12px; }
.card .meta .price { margin-left: auto; color: var(--accent); font-weight: 700; font-size: 14px; }
.card .meta .price.free { color: var(--ok); }

/* 课程详情 */
.player-wrap { background: #000; position: sticky; top: 0; z-index: 15; }
.player-wrap video { width: 100%; aspect-ratio: 16/9; display: block; background: #000; }
.player-locked {
  width: 100%; aspect-ratio: 16/9; position: relative;
  background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center;
}
.player-locked::after { content: ""; position: absolute; inset: 0; background: rgba(10,14,30,0.55); }
.player-locked .lk { position: relative; z-index: 2; color: #fff; text-align: center; }
.player-locked .lk .ic { font-size: 30px; }
.player-locked .lk .t { font-size: 14px; margin-top: 6px; opacity: 0.9; }

/* 音频章节播放器 */
.audio-player {
  width: 100%; aspect-ratio: 16/9; background: linear-gradient(135deg, #2e3a59, #1b2540);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 0 24px;
}
.audio-player .audio-ic { font-size: 46px; }
.audio-player .audio-title { color: #e8ecf5; font-size: 14px; text-align: center; max-width: 90%; }
.audio-player audio { width: 100%; max-width: 420px; }

/* 纯图文章节占位 */
.media-note {
  width: 100%; aspect-ratio: 16/9; background: linear-gradient(135deg, #3a3550, #262035);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #fff;
}
.media-note .ic { font-size: 40px; }
.media-note .t { font-size: 14px; opacity: 0.9; }

.detail-head { background: var(--card); padding: 16px; border-bottom: 8px solid var(--bg); }
.detail-head .cat { display: inline-block; background: #eef3ff; color: var(--brand); font-size: 12px; padding: 2px 10px; border-radius: 20px; margin-bottom: 8px; }
.detail-head h2 { font-size: 20px; margin: 0 0 8px; }
.detail-head .nowplay { color: var(--ink-3); font-size: 13px; }

/* tab 切换 */
.tabs { display: flex; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.tabs.below-player { top: 0; }
.tabs button {
  flex: 1; border: 0; background: none; padding: 13px 0; font-size: 15px; color: var(--ink-2);
  position: relative; font-weight: 500;
}
.tabs button.on { color: var(--brand); font-weight: 700; }
.tabs button.on::after { content: ""; position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); width: 24px; height: 3px; border-radius: 3px; background: var(--brand); }

.panel { background: var(--card); }
.panel.pad { padding: 16px; }

/* 章节目录 */
.chapter {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.chapter:active { background: #fafbfc; }
.chapter.active { background: #eff4ff; }
.chapter .idx { width: 22px; color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; flex: none; text-align: center; }
.chapter.active .idx { color: var(--brand); font-weight: 700; }
.chapter .info { flex: 1; min-width: 0; }
.chapter .info .t { font-size: 15px; color: var(--ink); margin: 0 0 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter.active .info .t { color: var(--brand); font-weight: 600; }
.chapter .info .s { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.chapter .pbar { height: 3px; background: var(--line); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.chapter .pbar i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.chapter .right { flex: none; color: var(--ink-3); font-size: 18px; }
.chapter .right .free { font-size: 11px; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 0 4px; }
.chapter .right .done { color: var(--ok); }

/* 讲义 markdown */
.handout { padding: 4px 16px 20px; }
.handout h1 { font-size: 19px; margin: 18px 0 10px; }
.handout h2 { font-size: 16px; margin: 16px 0 8px; }
.handout h3 { font-size: 15px; margin: 14px 0 6px; }
.handout p { margin: 8px 0; color: var(--ink-2); }
.handout ul, .handout ol { padding-left: 22px; color: var(--ink-2); }
.handout li { margin: 4px 0; }
.handout blockquote { margin: 10px 0; padding: 8px 14px; background: #fff8f0; border-left: 3px solid var(--accent); color: var(--ink-2); border-radius: 0 8px 8px 0; }
.handout em { color: var(--ink-3); font-style: normal; font-size: 13px; }

/* 底部解锁条 */
.unlockbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: #fff; border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px; max-width: 720px; margin: 0 auto;
}
.unlockbar .txt { flex: 1; min-width: 0; }
.unlockbar .txt .l1 { font-size: 13px; color: var(--ink-2); }
.unlockbar .txt .l2 { font-size: 12px; color: var(--ink-3); }
.btn {
  border: 0; border-radius: 24px; padding: 11px 22px; font-size: 15px; font-weight: 700;
  background: var(--brand); color: #fff; white-space: nowrap;
}
.btn:active { background: var(--brand-deep); }
.btn.ghost { background: #eef3ff; color: var(--brand); }
.btn:disabled { background: var(--lock); color: #fff; }

/* 状态/空 */
.center-tip { text-align: center; color: var(--ink-3); padding: 60px 20px; font-size: 14px; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 确认弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 32px;
  animation: modalfade .15s ease;
}
@keyframes modalfade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 320px; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,0.2); }
.modal-title { font-size: 17px; font-weight: 700; text-align: center; padding: 22px 20px 10px; }
.modal-body { font-size: 14px; color: var(--ink-2); line-height: 1.7; padding: 0 22px 20px; text-align: center; }
.modal-body b { color: var(--accent); font-size: 17px; }
.modal-body .muted { color: var(--ink-3); font-size: 13px; }
.modal-actions { display: flex; border-top: 1px solid var(--line); }
.modal-btn { flex: 1; border: 0; background: #fff; padding: 14px 0; font-size: 16px; }
.modal-btn.cancel { color: var(--ink-3); border-right: 1px solid var(--line); }
.modal-btn.ok { color: var(--brand); font-weight: 700; }
.modal-btn:active { background: #f5f6f8; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: rgba(0,0,0,0.82); color: #fff; padding: 10px 18px; border-radius: 22px;
  font-size: 14px; z-index: 100; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 80%;
}
.toast.show { opacity: 1; }

/* ========== 迁移：登录/绑定引导横幅 + 绑定页 ========== */
.notice {
  margin: 14px 16px 0; background: linear-gradient(135deg, #eef3ff, #f6f9ff);
  border: 1px solid #dbe6ff; border-radius: var(--radius);
  padding: 14px 16px; display: flex; align-items: center; gap: 12px;
}
.notice .nx { flex: 1; min-width: 0; }
.notice .nt { font-size: 15px; font-weight: 600; color: var(--ink); }
.notice .ns { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.notice .notice-btn {
  border: 0; border-radius: 22px; padding: 9px 18px; font-size: 14px; font-weight: 700;
  background: var(--brand); color: #fff; white-space: nowrap;
}
.notice .notice-btn:active { background: var(--brand-deep); }

.bind-card { background: var(--card); margin: 16px; border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 18px; }
.bind-card .bt { font-size: 18px; font-weight: 700; margin: 0 0 6px; }
.bind-card .bs { font-size: 13px; color: var(--ink-3); margin: 0 0 18px; line-height: 1.6; }
.bind-input {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; font-size: 17px; letter-spacing: 1px; outline: none; margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
}
.bind-input:focus { border-color: var(--brand); }
.bind-submit {
  width: 100%; border: 0; border-radius: 24px; padding: 13px 0; font-size: 16px; font-weight: 700;
  background: var(--brand); color: #fff;
}
.bind-submit:active { background: var(--brand-deep); }
.bind-submit:disabled { background: var(--lock); }
.bind-tip { font-size: 12px; color: var(--ink-3); margin-top: 14px; text-align: center; line-height: 1.7; }
.bind-result { text-align: center; padding: 24px 0 8px; }
.bind-result .ic { font-size: 44px; }
.bind-result .rt { font-size: 17px; font-weight: 700; margin: 10px 0 4px; }
.bind-result .rs { font-size: 13px; color: var(--ink-3); margin-bottom: 18px; }
