/* ==========================================================================
   全站组件样式 —— Bootstrap 5 + 原生 JS，禁 Tailwind / 禁 jQuery
   移动端优先（微信 H5），≥992px 渐进增强为桌面布局
   ========================================================================== */
* {
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-body);
  background: #f5f7fa;
}

a {
  color: var(--brand);
  text-decoration: none;
}
a:hover {
  color: var(--brand-dark);
}

/* ---------------------------------------------------------------- 布局 */
.app-main {
  padding: 1rem 1rem calc(var(--tabbar-h) + 1.5rem);
}
.container-page {
  max-width: var(--content-max);
  margin: 0 auto;
}

@media (min-width: 992px) {
  .app-main {
    padding: 1.5rem 1.5rem 2.5rem;
  }
}

/* ---------------------------------------------------------------- 卡片 */
.card-it {
  background: #fff;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 1.25rem;
}

/* 区块标题：左侧 3px 品牌色竖条 */
.section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-title);
  margin-bottom: 0.75rem;
}
.section-title::before {
  content: "";
  width: 3px;
  height: 16px;
  border-radius: 2px;
  background: var(--brand);
  flex: none;
}
.section-title .more {
  margin-left: auto;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------- 按钮 */
.btn {
  border-radius: var(--radius-btn);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
}
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn-primary:hover,
.btn-primary:focus {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}
.btn-orange {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}
.btn-orange:hover {
  background: #ea580c;
  border-color: #ea580c;
  color: #fff;
}
.btn-block {
  width: 100%;
}
.btn-sm-it {
  height: 30px;
  line-height: 1;
  padding: 0 0.75rem;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  white-space: nowrap; /* 小按钮文字不换行，避免窄屏被拆成竖排 */
}

/* 首页 CTA 渐变 */
.gradient-brand {
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
}
.gradient-ocean {
  background: linear-gradient(135deg, var(--brand), var(--cyan));
}
.gradient-warm {
  background: linear-gradient(135deg, var(--orange), var(--amber));
}
.gradient-fresh {
  background: linear-gradient(135deg, var(--green), var(--cyan));
}

/* ---------------------------------------------------------------- 徽章 */
.badge-it {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.6;
}
.badge-brand {
  background: var(--brand-tint);
  color: var(--brand);
}
.badge-green {
  background: var(--green-bg);
  color: var(--green);
}
.badge-orange {
  background: var(--orange-bg);
  color: var(--orange);
}
.badge-amber {
  background: var(--amber-bg);
  color: #b45309;
}
.badge-red {
  background: var(--danger-bg);
  color: var(--danger);
}
.badge-blue {
  background: var(--badge-blue-bg);
  color: var(--badge-blue);
}
.badge-gray {
  background: var(--brand-border);
  color: var(--text-faint);
}

/* 胶囊 */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 32px;
  padding: 0 0.75rem;
  border-radius: var(--radius-pill);
  background: var(--brand-tint);
  color: var(--brand);
  font-size: 0.8125rem;
  font-weight: 600;
}
.pill-orange {
  background: var(--orange-bg);
  color: var(--orange);
}

/* ---------------------------------------------------------------- 头像 */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  background: linear-gradient(135deg, var(--brand), var(--orange));
  flex: none;
}
.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 1.25rem;
}

/* 右上角账号下拉：头像 + 用户名 + 箭头 */
.user-menu-btn { color: var(--text); line-height: 1; }
.user-menu-btn:focus { outline: none; box-shadow: none; }
.user-menu-name { font-weight: 600; font-size: .875rem; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-btn .avatar { width: 32px; height: 32px; font-size: .8125rem; }


/* ---------------------------------------------------------------- 顶栏 */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--brand-border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}
/* 站点 Logo（原图 1618×1617 方形印章）：固定高度、宽度按原比例自动，永远等比不变形 */
.topbar .brand-logo {
  height: 32px;
  width: auto;
  flex: none;
  display: block;
}
.brand-logo-login {
  height: 64px;
  width: auto;
}
.topbar .site-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-title);
  margin-left: 0.5rem;
}
.topbar .page-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-title);
}
.topbar-nav {
  display: none;
}
@media (min-width: 992px) {
  .topbar {
    height: 64px;
    padding: 0 2rem;
  }
  .topbar .brand-logo {
    height: 40px;
  }
  .topbar-nav {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    margin-left: 1.5rem;
  }
  .topbar-nav a {
    color: var(--text-body);
    font-size: 0.9375rem;
  }
  .topbar-nav a.active {
    color: var(--brand);
    font-weight: 600;
  }
}

/* ---------------------------------------------------------------- 底部 Tab */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
  border-top: 1px solid var(--brand-border);
  display: flex;
  z-index: 1030;
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.6875rem;
  color: var(--text-faint);
}
.tabbar a.active {
  color: var(--brand);
}
.tabbar a i {
  font-size: 1.25rem;
  line-height: 1;
}
@media (min-width: 992px) {
  .tabbar {
    display: none;
  }
}

/* ---------------------------------------------------------------- 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.data-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.625rem 0.5rem;
  border-bottom: 1px solid var(--brand-border);
}
.data-table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--brand-border);
  color: var(--text-body);
}
.data-table tr:last-child td {
  border-bottom: none;
}
/* 移动端：表格隐藏次要列 */
@media (max-width: 575px) {
  .data-table .col-hide-sm {
    display: none;
  }
  /* 兑换审核：操作按钮在窄屏竖排，别把「状态」列挤没 */
  .redeem-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px !important;
  }
  /* 兜底：万一还是放不下，让卡片内部横向滚动，别撑破整个页面 */
  .table-scroll {
    overflow-x: auto;
  }
  /* 窄屏徽章不拆行（「已通过」不要断成两行），顺带收窄内边距 */
  .table-scroll .badge-it {
    white-space: nowrap;
    padding: 2px 6px;
  }
}

/* ---------------------------------------------------------------- 进度条 */
.progress-it {
  height: 6px;
  border-radius: 3px;
  background: var(--brand-border);
  overflow: hidden;
}
.progress-it > span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--brand);
}

/* ---------------------------------------------------------------- 课程卡 */
.course-card {
  background: #fff;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.course-card .cover {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.375rem;
  font-weight: 700;
}
/* 封面图片：单独样式，绝不能用 .cover 的 display:flex（会让 <img> 在 Chrome 中变成空盒子，图片被隐藏） */
/* 比例锁定 16:9，大图等比例缩放，比例不对取短边（完整显示、长边留浅灰底，不裁切） */
.course-card .cover-img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  object-fit: contain;
  background: #f1f1f4;
}
.course-card .body {
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

/* 手机端课程卡（首页「在学课程」与「我的课程」共用）：左右布局（图左文右），更省纵向空间 */
@media (max-width: 767.98px) {
  .course-card--list {
    flex-direction: row;
    align-items: center;                 /* 缩略图垂直居中 */
    padding: 0.7rem 0.8rem;              /* 卡片内边距：缩略图不再贴住边框 */
  }
  /* 缩略图：固定正方形、圆角、与文字保持间距（不贴边框、不贴文字） */
  .course-card--list > .cover,
  .course-card--list > .cover-img {
    width: 76px;
    height: 76px;
    min-width: 76px;
    flex: 0 0 76px;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    object-fit: cover;                   /* 16:9 封面裁成中心方图，列表缩略图常规做法 */
    margin-right: 0.8rem;                /* 与右侧文字的距离 */
  }
  .course-card--list > .body {
    padding: 0;                          /* 内边距统一由卡片提供，避免重复 */
    gap: 0.25rem;
    justify-content: center;
  }
  .course-card--list > .body .fw-semibold {
    font-size: 0.9rem;
  }
  .course-card--list > .body .text-muted-it {
    font-size: 0.72rem !important;
  }
}

/* 权限设置触发卡片（编辑课程页弹窗入口） */
.perm-trigger {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: background-color .15s ease;
}
.perm-trigger:hover { background: #f7f9fc; }
.perm-trigger .perm-trigger-text { flex: 1; min-width: 0; }
.perm-trigger .bi-shield-lock { color: var(--brand); }

/* ---------------------------------------------------------------- 播放器 */
.player-wrap {
  position: relative;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: #051c33;
}
.player-wrap video {
  display: block;
  width: 100%;
  background: #000;
  /* 微信 X5：同层 H5 播放，保证弹题与水印浮在视频之上 */
  object-fit: contain;
}
.watermark {
  position: absolute;
  left: 16px;
  top: 14px;
  color: #fff;
  opacity: 0.18;
  font-size: 0.8125rem;
  pointer-events: none;
  transition: all 15s ease;
  z-index: 2;
}
.quiz-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(88%, 460px);
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-float);
  padding: 1.25rem;
  z-index: 5;
}
.quiz-option {
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  display: flex;
  gap: 0.625rem;
  align-items: center;
}
.quiz-option.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.quiz-option.correct {
  background: var(--green-bg);
  border-color: var(--green);
}
.quiz-option.wrong {
  background: var(--danger-bg);
  border-color: var(--danger);
}

/* ---------------------------------------------------------------- 页脚 */
.site-footer {
  display: none;
}
@media (min-width: 992px) {
  .site-footer {
    display: block;
    border-top: 1px solid var(--brand-border);
    background: #fff;
    padding: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
    text-align: center;
  }
}

/* ---------------------------------------------------------------- 工具类 */
.text-title {
  color: var(--text-title);
}
.text-muted-it {
  color: var(--text-muted);
}
.text-orange {
  color: var(--orange);
}
.text-green {
  color: var(--green);
}
.mobile-only {
  display: block;
}
.pc-only {
  display: none;
}
@media (min-width: 992px) {
  .mobile-only {
    display: none;
  }
  .pc-only {
    display: block;
  }
}

/* ---------------------------------------------------------------- 富文本正文 */
.rich-text img { max-width: 100%; height: auto; border-radius: 8px; margin: .5rem 0; }
.rich-text h1, .rich-text h2, .rich-text h3, .rich-text h4 {
  color: var(--text-title); font-weight: 700; margin: 1rem 0 .5rem; line-height: 1.5;
}
.rich-text h1 { font-size: 1.375rem; }
.rich-text h2 { font-size: 1.1875rem; }
.rich-text h3 { font-size: 1.0625rem; }
.rich-text ul, .rich-text ol { padding-left: 1.25rem; margin: .5rem 0; }
.rich-text li { margin: .25rem 0; }
.rich-text blockquote {
  margin: .75rem 0; padding: .5rem .875rem;
  border-left: 3px solid var(--brand); background: var(--brand-tint); color: var(--text-body);
}
.rich-text a { color: var(--brand); }
.rich-text pre {
  background: #f6f8fa; padding: .75rem; border-radius: 8px; overflow-x: auto; font-size: .8125rem;
}
.rich-text p { margin: .5rem 0; }

/* ------------------------------------------------- 联赛返回导航条（面包屑 + 返回按钮） */
.lg-backbar{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;margin-bottom:.75rem}
.lg-back{
  display:inline-flex;align-items:center;gap:.4rem;height:34px;padding:0 .9rem;
  border-radius:9999px;background:#fff;border:1px solid var(--brand-border);
  color:var(--brand-dark);font-size:.83rem;font-weight:600;text-decoration:none;white-space:nowrap;
  box-shadow:0 1px 3px rgba(0,0,0,.06);
  transition:background .15s ease,border-color .15s ease,transform .15s ease,box-shadow .15s ease;
}
.lg-back i{font-size:1rem;line-height:1;transition:transform .15s ease}
.lg-back:hover{
  background:var(--brand-tint);border-color:var(--brand);color:var(--brand-dark);
  transform:translateX(-3px);box-shadow:0 3px 10px rgba(0,124,200,.16);
}
.lg-back:hover i{transform:translateX(-2px)}
.lg-back:active{transform:translateX(-1px) scale(.98)}
.lg-crumb{
  font-size:.78rem;color:var(--text-faint);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.lg-crumb b{color:var(--text-body);font-weight:600}
@media (max-width:575.98px){
  .lg-back{height:32px;font-size:.8rem;padding:0 .75rem}
  .lg-crumb{display:none}
}
