/* ============================================================
   YouTube English Lab · 首页
   2026-10-13 视觉升级：白/浅灰底 + 品牌蓝（与后台 admin.css 同一 token 体系）
   ============================================================ */

:root {
  color-scheme: light;
  --header-bg: rgba(247, 248, 250, 0.88);

  /* 基础色（中性灰阶） */
  --bg: #f7f8fa;
  --bg-soft: #f1f3f6;
  --surface: #ffffff;
  --surface-warm: #ffffff;
  --line: #e3e7ee;
  --line-soft: #eaedf2;

  /* 文字 */
  --text: #12161d;
  --text-soft: #3a4351;
  --muted: #6e7887;

  /* 主题色：品牌蓝 + 蓝紫辅色 */
  --primary: #2f6feb;
  --primary-light: #eff4ff;
  --primary-soft: #c8dbff;
  --accent: #e5484d;
  --accent-light: #fdecec;
  --teal: #0f7b3f;
  --teal-light: #f2fdf6;
  --purple: #6e5af2;
  --purple-light: #f1efff;
  --green: #0f7b3f;
  --green-light: #f2fdf6;
  --yellow: #f0a020;

  /* 阴影：克制 */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.07);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);
  --shadow-hover: 0 8px 24px rgba(47, 111, 235, 0.14);

  /* 圆角 */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 999px;

  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- 深色主题（照 vel：右上角浅色/深色切换，记忆在 localStorage）----
   只覆盖颜色变量，版式零改动 —— 全站 194 处 var(--) 自动跟随。 */
:root[data-theme="dark"] {
  color-scheme: dark;
  --header-bg: rgba(18, 21, 27, 0.85);
  --bg: #12151b;
  --bg-soft: #171b22;
  --surface: #1d222b;
  --surface-warm: #1d222b;
  --line: #2c333f;
  --line-soft: #262d38;
  --text: #e8eaf0;
  --text-soft: #c3c9d4;
  --muted: #8b93a2;
  --primary: #5b8ef7;
  --primary-light: #1c2740;
  --primary-soft: #2a3a5e;
  --accent: #f26d72;
  --accent-light: #3a2528;
  --teal: #4cc38a;
  --teal-light: #16281f;
  --purple: #9487f7;
  --purple-light: #241f3d;
  --green: #4cc38a;
  --green-light: #16281f;
  --yellow: #f5b04d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
  --shadow-hover: 0 8px 24px rgba(91, 142, 247, 0.25);
}

/* ---- 顶栏右侧：主题切换 + 用户头像下拉（照 vel 的形态）---- */
.header-user {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  cursor: pointer;
  transition: var(--transition);
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--primary);
}
.theme-toggle .theme-switch {
  width: 30px;
  height: 16px;
  border-radius: var(--r-full);
  background: var(--line);
  position: relative;
  transition: background var(--transition);
}
.theme-toggle .theme-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
}
:root[data-theme="dark"] .theme-toggle .theme-knob {
  transform: translateX(14px);
}
:root[data-theme="dark"] .theme-toggle .theme-label-light {
  color: var(--muted);
}
.theme-toggle .theme-label-dark {
  color: var(--muted);
}
:root[data-theme="dark"] .theme-toggle .theme-label-dark {
  color: var(--primary);
  font-weight: 600;
}

.user-chip {
  position: relative;
}
.user-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  font-size: 13px;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: background var(--transition);
}
.user-chip-btn:hover {
  background: var(--bg-soft);
}
.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.user-caret {
  font-size: 10px;
  color: var(--muted);
}
.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 150px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  z-index: 60;
}
.user-menu a,
.user-menu button {
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  background: none;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.user-menu a:hover,
.user-menu button:hover {
  background: var(--bg-soft);
}

/* ---- 下拉菜单里的 AI积分统计块（照 vel 一比一）---- */
.um-stats { padding: 4px 6px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; min-width: 210px; }
.um-title { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.um-title .um-ico { font-size: 13px; }
.um-title .um-refresh { margin-left: auto; cursor: pointer; opacity: .7; }
.um-title .um-refresh:hover { opacity: 1; }
.um-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.um-row > div { background: var(--bg-soft); border-radius: var(--r-sm); padding: 9px 6px; text-align: center; }
.um-row small { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.um-row b { font-size: 16px; color: var(--primary); }
.user-menu .mi { display: inline-block; width: 20px; margin-right: 2px; font-size: 12px; }
.um-sep { height: 1px; background: var(--line); margin: 6px 0; }

/* ---- 修改密码弹窗 ---- */
.pwd-mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px;
}
.pwd-card {
  width: min(380px, 94vw); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 24px 26px; position: relative; box-shadow: var(--shadow-lg);
}
.pwd-close {
  position: absolute; top: 12px; right: 14px; width: 28px; height: 28px;
  border: none; border-radius: 50%; background: var(--bg-soft);
  color: var(--muted); cursor: pointer; font-size: 13px;
}
.pwd-card h3 { font-size: 17px; color: var(--text); margin-bottom: 18px; }
.pwd-card label { display: block; font-size: 12.5px; color: var(--text-soft); margin-bottom: 14px; }
.pwd-card input {
  width: 100%; margin-top: 6px; padding: 10px 12px; font-size: 13.5px;
  color: var(--text); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: var(--r-sm); outline: none;
}
.pwd-card input:focus { border-color: var(--primary); }
.pwd-msg { min-height: 1.2em; font-size: 12.5px; color: var(--accent); margin: 4px 0 8px; }
.pwd-actions { display: flex; justify-content: flex-end; gap: 10px; }
.pwd-actions button {
  padding: 9px 20px; font-size: 13px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: transparent; color: var(--text-soft); cursor: pointer;
}
.pwd-actions button.primary {
  background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600;
}

/* ---- 未开通资料库：首页原位空状态（照 vel）----
   body.library-locked 时隐藏课程区，显示 🎁 开通引导。 */
body.library-locked .library-shell {
  display: none;
}
.library-empty {
  display: none;
  padding: 40px 20px 80px;
}
body.library-locked .library-empty {
  display: block;
}
.library-empty .le-card {
  max-width: 430px;
  margin: 30px auto 0;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 48px 26px 40px;
}
.library-empty .le-gift { font-size: 40px; }
.library-empty h2 { font-size: 21px; color: var(--text); margin: 12px 0 8px; }
.library-empty p { font-size: 13px; color: var(--muted); margin: 0 0 20px; }
.library-empty .le-btn {
  display: inline-block; padding: 11px 34px; font-size: 14px;
  color: #241d15; background: #e3c6a8; border-radius: 10px;
  text-decoration: none; font-weight: 600;
}
.library-empty .le-btn:hover { background: #d6b898; }
.library-empty .le-help {
  margin-top: 26px; text-align: left;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 16px 18px;
}
.library-empty .le-help h4 { font-size: 13px; color: var(--text-soft); margin: 0 0 10px; }
.library-empty .le-help ol { margin: 0 0 12px; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 2; }
.library-empty .le-tip {
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--muted); line-height: 1.7;
}
.library-empty .le-tip a {
  color: #0d9488; text-decoration: none; font-weight: 600;
  display: inline-block; margin-left: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "SF Pro Text", "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

/* ============================================
   顶栏
   ============================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 68px;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg, rgba(247, 248, 250, 0.88));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 14px clamp(20px, 4vw, 48px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  background: var(--primary);
  color: #fff;
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(47, 111, 235, 0.25);
}

.brand-text {
  display: grid;
  gap: 1px;
}

.brand-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  line-height: 24px;
  color: var(--text);
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.5px;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.top-nav a {
  position: relative;
  padding: 7px 16px;
  border-radius: var(--r-full);
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
}

.top-nav a:hover {
  color: var(--text);
  background: var(--bg-soft);
}

.top-nav a.active {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 4px 12px rgba(47, 111, 235, 0.25);
}

/* ============================================
   主体布局
   ============================================ */

.library-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  padding: 24px clamp(20px, 4vw, 48px) 48px;
}

/* ============================================
   侧边栏
   ============================================ */

.filter-sidebar {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 108px);
  overflow-y: auto;
  padding: 4px 0 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.filter-sidebar::-webkit-scrollbar {
  width: 4px;
}

.filter-sidebar::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

.filter-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

/* 统计卡片 */

.stats-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 28px;
}

.stat-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 68px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: all var(--transition);
}

.stat-card:hover {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.stat-card.active {
  border-color: var(--primary-soft);
  background: var(--primary-light);
  box-shadow: 0 4px 16px rgba(43, 95, 138, 0.08);
}

.stat-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  font-weight: 700;
  font-size: 18px;
}

.stat-icon.grid {
  background: var(--primary-light);
  color: var(--primary);
}

.stat-icon.learned {
  background: var(--green-light);
  color: var(--green);
}

.stat-icon.pending {
  background: var(--bg-soft);
  color: var(--text-soft);
}

.stat-icon.favorite {
  background: var(--accent-light);
  color: var(--accent);
}

.stat-card strong {
  display: block;
  font-size: 15px;
  line-height: 20px;
  font-weight: 700;
}

.stat-card small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.stat-card b {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.stat-card:nth-child(2) b {
  color: var(--green);
}

.stat-card:nth-child(3) b {
  color: var(--text-soft);
}

.stat-card:nth-child(4) b {
  color: var(--accent);
}

/* 筛选面板 */

.filter-panel {
  margin-top: 20px;
}

.filter-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.filter-title h2 {
  margin: 0;
  font-size: 16px;
  line-height: 22px;
  font-weight: 700;
  color: var(--text);
}

.filter-title button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  transition: all var(--transition);
}

.filter-title button:hover {
  color: var(--primary);
  background: var(--primary-light);
}

/* 日历 */

.inline-calendar {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.month-button {
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.month-button::after {
  margin-left: 4px;
  content: "▾";
  font-size: 11px;
  color: var(--muted);
}

.month-arrows {
  display: flex;
  gap: 12px;
  line-height: 1;
}

.month-arrows button {
  border: 0;
  background: transparent;
  color: var(--text-soft);
  padding: 0;
  font-size: 18px;
  line-height: 1;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  transition: all var(--transition);
}

.month-arrows button:hover {
  background: var(--bg-soft);
  color: var(--primary);
}

.month-arrows button:disabled,
.month-arrows button.is-disabled {
  color: var(--line);
  cursor: default;
}

.month-arrows button:disabled:hover {
  background: transparent;
}

.calendar-weekdays,
.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  text-align: center;
}

.calendar-weekdays {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.calendar-days {
  row-gap: 4px;
}

.calendar-days button {
  position: relative;
  display: inline-grid;
  place-items: center;
  justify-self: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}

.calendar-days button:hover:not(:disabled):not(.is-future) {
  background: var(--primary-light);
  color: var(--primary);
  transform: scale(1.05);
}

.calendar-days button:disabled,
.calendar-days button.is-future {
  cursor: default;
  opacity: 0.35;
}

.calendar-days button.muted {
  color: var(--line);
}

.calendar-days button.is-today {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.calendar-days button.selected {
  background: var(--text);
  color: #fff;
  border: 1px solid var(--text);
}

.calendar-days button.checked,
.calendar-days button[data-checkin="done"].checked {
  border: 1px solid var(--green);
  background: var(--green-light);
  color: var(--green);
  font-weight: 700;
}

.calendar-days button.selected.checked {
  border-color: var(--green);
  background: var(--green-light);
  color: var(--green);
}

.calendar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}

.calendar-actions button {
  border: 0;
  background: transparent;
  color: var(--primary);
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}

.calendar-actions button:hover {
  background: var(--primary-light);
}

.checkin-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-warm);
  padding: 10px 12px;
}

.checkin-summary div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.checkin-summary strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
}

.checkin-summary span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.checkin-summary button {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--primary);
  padding: 4px 8px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 700;
  transition: all var(--transition);
}

.checkin-summary button:hover {
  background: var(--primary-light);
}

.checkin-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.checkin-metrics span {
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  color: var(--text-soft);
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}

.checkin-metrics b {
  display: block;
  color: var(--text);
  font-size: 16px;
  line-height: 20px;
  font-weight: 700;
}

/* 主题标签 */

.topic-filter {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.topic-filter > span {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.topic-grid button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-soft);
  font-weight: 600;
  font-size: 13px;
  padding: 0 8px;
  transition: all var(--transition);
}

.topic-grid button:hover {
  border-color: var(--primary-soft);
  color: var(--primary);
  background: var(--primary-light);
}

.topic-grid button.active {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(47, 111, 235, 0.22);
}

/* ============================================
   主内容区
   ============================================ */

.library-main {
  min-width: 0;
}

.mobile-filter-actions {
  display: none;
}

.main-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 24px;
}

.main-toolbar p,
.main-toolbar h1 {
  margin: 0;
}

.main-toolbar p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.main-toolbar h1 {
  margin-top: 4px;
  font-size: 30px;
  line-height: 38px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}


/* 课程卡片上的合集徽标 */
.card-collection {
  display: inline-block;
  min-width: 0;
  flex: 0 1 auto;
  max-width: 100%;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.search-box {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: min(400px, 44vw);
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--muted);
  padding: 0 16px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  color: var(--text);
}

.search-box input::placeholder {
  color: var(--muted);
}

.search-box kbd {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
}

/* ============================================
   课程卡片网格
   ============================================ */

.course-grid {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.course-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 240ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 240ms ease;
  position: relative;
}

.course-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary-soft);
}

.course-card.is-hidden {
  display: none;
}

.course-card.is-favorite {
  border-color: var(--accent);
  box-shadow: 0 16px 40px rgba(232, 115, 74, 0.15);
}

.course-card.is-favorite .stars::before {
  color: var(--accent);
  content: "♥ ";
}

/* 封面 */

.thumb {
  position: relative;
  display: grid;
  align-content: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #e3e7ee;
  color: #fff;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease;
}

.course-card:hover .thumb img {
  transform: scale(1.06);
}

.thumb::after {
  position: absolute;
  inset: auto 0 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.5));
  content: "";
}

.thumb-title {
  position: relative;
  z-index: 1;
  justify-self: center;
  max-width: 74%;
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  line-height: 30px;
  text-align: center;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

/* 封面配色 */

.thumb-invest {
  background:
    linear-gradient(135deg, rgba(17, 24, 39, 0.1), rgba(17, 24, 39, 0.5)),
    radial-gradient(circle at 28% 46%, rgba(47, 111, 235, 0.35) 0 22%, transparent 23%),
    linear-gradient(135deg, #1a2638, #6281a0);
}

.thumb-garden {
  background:
    linear-gradient(135deg, rgba(16, 38, 24, 0.18), rgba(16, 38, 24, 0.5)),
    linear-gradient(120deg, #7e97bd, #c2ccd9 52%, #93a9cf);
}

.thumb-kitchen {
  background:
    linear-gradient(135deg, rgba(82, 45, 28, 0.1), rgba(82, 45, 28, 0.42)),
    linear-gradient(120deg, #c8d2e2, #8b9bb5 48%, #e8ecf2);
}

.thumb-life {
  background:
    linear-gradient(135deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.42)),
    linear-gradient(120deg, #9aa8bf, #5d6b85 50%, #2c3648);
}

.thumb-room {
  background:
    linear-gradient(135deg, rgba(96, 54, 86, 0.1), rgba(96, 54, 86, 0.4)),
    linear-gradient(120deg, #d3d9e6, #a9b6cc 50%, #93aad4);
}

.thumb.thumb-generated {
  min-height: 174px;
  background:
    linear-gradient(135deg, rgba(17, 24, 39, 0.18), rgba(17, 24, 39, 0.54)),
    radial-gradient(circle at 30% 42%, #8dd9c5 0 20%, transparent 21%),
    linear-gradient(120deg, #24374d, #6e7f96 54%, #b3c0d4);
}

/* 时长和署名 */

.duration,
.source {
  position: absolute;
  z-index: 2;
  bottom: 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.duration {
  left: 12px;
  max-width: 26%;
  background: rgba(0, 0, 0, 0.45);
  border-radius: var(--r-sm);
  padding: 3px 8px;
  backdrop-filter: blur(4px);
}

.source {
  right: 12px;
  max-width: 64%;
  text-align: right;
}

/* 卡片主体 */

.card-body {
  padding: 16px 18px 16px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-head h2 {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.stars {
  color: var(--yellow);
  cursor: pointer;
  font-size: 14px;
  letter-spacing: 0;
  white-space: nowrap;
  transition: transform var(--transition);
}

.stars:hover {
  transform: scale(1.15);
}

.stars i {
  color: var(--line);
  font-style: normal;
}

.course-title {
  min-height: 42px;
  margin: 8px 0 12px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 22px;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 30px;
  color: var(--muted);
  font-size: 13px;
}

.meta-row span:first-child {
  border-radius: var(--r-full);
  background: var(--primary-light);
  color: var(--primary);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
}

.meta-row span:last-child {
  color: var(--muted);
  font-weight: 500;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* ★ 2026-10-17：iPad 竖屏(768)/横屏(1024) 下三项挤在一行会把中文从词中间折断
     （"办公室对 话"），改成可换行 + 每项不内部断行。宽屏空间够，不会触发换行。 */
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 16px;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.card-foot > * {
  white-space: nowrap;
}

.card-foot time {
  color: var(--muted);
}

/* 空状态 */

.empty-state {
  display: none;
  margin: 48px 0 0;
  border: 1px dashed var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--muted);
  padding: 48px 32px;
  text-align: center;
  font-size: 15px;
}

.empty-state.is-visible {
  display: block;
}

/* ============================================
   Toast
   ============================================ */

.toast {
  position: fixed;
  right: 30px;
  bottom: 102px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 32px));
  transform: translateY(12px);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--text);
  color: #fff;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  transition: opacity 200ms ease, transform 200ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

/* ============================================
   账号面板
   ============================================ */

.account-panel {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(26, 31, 46, 0.3);
  backdrop-filter: blur(6px);
  padding: 18px;
}

.account-card {
  width: min(420px, 100%);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  padding: 28px 26px 24px;
}

.account-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.account-head p,
.account-head h2 {
  margin: 0;
}

.account-head p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.account-head h2 {
  margin-top: 4px;
  font-size: 26px;
  line-height: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.account-head button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 22px;
  line-height: 1;
  transition: all var(--transition);
}

.account-head button:hover {
  background: var(--bg-soft);
  border-color: var(--text-soft);
}

.account-status {
  margin-top: 16px;
  border-radius: var(--r-md);
  background: var(--surface-warm);
  border: 1px solid var(--line);
  color: var(--text-soft);
  padding: 14px;
  font-size: 14px;
  line-height: 22px;
}

.account-status.is-active {
  border-color: var(--green);
  background: var(--green-light);
  color: var(--green);
  font-weight: 600;
}

.redeem-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.redeem-form label {
  display: grid;
  gap: 8px;
}

.redeem-form span {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

.redeem-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  outline: 0;
  padding: 12px 14px;
  font-size: 15px;
  letter-spacing: 1px;
  transition: all var(--transition);
}

.redeem-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.redeem-form button {
  min-height: 46px;
  border: 0;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--primary), var(--teal));
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 4px 16px rgba(43, 95, 138, 0.25);
  transition: all var(--transition);
}

.redeem-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(43, 95, 138, 0.3);
}

.redeem-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ============================================
   响应式
   ============================================ */

@media (max-width: 1180px) {
  .library-shell {
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 20px;
  }

  .course-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .main-toolbar h1 {
    font-size: 28px;
  }
}

@media (max-width: 1024px) {
  .library-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .course-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }
}

@media (max-width: 860px) {
  .site-header {
    align-items: center;
    display: grid;
    gap: 14px;
    padding: 14px 16px;
  }

  .top-nav {
    overflow-x: auto;
    gap: 4px;
    padding: 3px;
    scrollbar-width: none;
    white-space: nowrap;
  }

  .top-nav::-webkit-scrollbar {
    display: none;
  }

  .library-shell {
    grid-template-columns: 1fr;
    padding: 16px 16px 40px;
  }

  .filter-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    border-bottom: 1px solid var(--line);
    padding: 0 0 20px;
  }

  .stats-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 20px;
  }

  .stat-card {
    min-height: 62px;
    padding: 10px 12px;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
  }

  .stat-card strong {
    font-size: 14px;
  }

  .stat-card small {
    font-size: 11px;
  }

  .stat-card b {
    font-size: 20px;
  }

  .main-toolbar {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
  }

  .main-toolbar h1 {
    font-size: 26px;
  }

  .search-box {
    width: 100%;
  }

  .mobile-filter-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
  }

  .mobile-filter-actions button {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    transition: all var(--transition);
  }

  .mobile-filter-actions button.active {
    background: var(--text);
    color: #fff;
    border-color: transparent;
  }

  .collapsible-panel {
    display: none;
  }

  .collapsible-panel.is-open {
    display: block;
  }

  .filter-title h2 {
    font-size: 15px;
  }

  .library-main {
    border-top: 1px solid var(--line);
    padding-top: 20px;
  }
}

@media (max-width: 640px) {
  .course-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .card-body {
    padding: 12px 12px 12px;
  }

  .card-head h2 {
    font-size: 12px;
  }

  .stars {
    font-size: 11px;
  }

  .course-title {
    font-size: 13px;
    line-height: 19px;
    min-height: 36px;
    margin: 6px 0 8px;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    display: -webkit-box;
    overflow: hidden;
  }

  .meta-row {
    font-size: 11px;
    min-height: 26px;
  }

  .meta-row span:first-child {
    font-size: 11px;
    padding: 3px 8px;
  }

  .card-foot {
    font-size: 11px;
    margin-top: 10px;
    padding-top: 8px;
  }

  .thumb-title {
    font-size: 18px;
    line-height: 24px;
    max-width: 86%;
  }

  .source {
    display: none;
  }

  .brand-title {
    font-size: 18px;
  }

  .brand-subtitle {
    font-size: 11px;
  }
}

@media (max-width: 420px) {
  .site-header {
    padding: 12px 12px;
  }

  .library-shell {
    padding: 12px 12px 30px;
  }

  .stats-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 8px;
  }

  .stat-card b {
    grid-column: 2;
    justify-self: start;
    font-size: 18px;
  }

  .course-grid {
    gap: 12px;
  }

  .thumb-title {
    font-size: 16px;
  }
}

/* ---- 使用教程浮层（照 vel）---- */
.method-mask {
  position: fixed; inset: 0; z-index: 90;
  background: #0d1117; overflow-y: auto;
  display: grid; justify-items: center; align-items: start;
  padding: 40px 20px 80px;
}
.method-mask[hidden] { display: none; }
.method-wrap { width: min(92vw, 900px); display: flex; flex-direction: column; gap: 24px; position: relative; }
.method-close {
  position: fixed; top: 22px; right: 30px; width: 36px; height: 36px;
  border: none; border-radius: 50%; background: #1b2230; color: #cbd3df;
  font-size: 15px; cursor: pointer; z-index: 2;
}
.method-close:hover { background: #26304a; color: #fff; }
.mt-card {
  background: #141a26; border: 1px solid #232a3a; border-radius: 16px; padding: 30px 34px;
}
.mt-hero {
  background: linear-gradient(140deg, #141a26 55%, #123b36 100%);
  border-color: #1f4a44;
}
.mt-kicker { font-size: 11px; letter-spacing: .18em; color: #2dd4bf; margin: 0 0 14px; }
.mt-card h1 { font-size: 22px; color: #eef1f6; margin: 0 0 14px; }
.mt-desc { font-size: 13.5px; color: #aab4c8; line-height: 1.8; margin: 0 0 18px; }
.mt-btn {
  display: inline-block; padding: 10px 22px; font-size: 13px; color: #241d15;
  background: #e3c6a8; border-radius: 8px; text-decoration: none;
}
.mt-btn:hover { background: #d6b898; }
.mt-card h2 { font-size: 18px; color: #eef1f6; margin: 0 0 18px; }
.mt-os { background: #10141f; border: 1px solid #232a3a; border-radius: 10px; padding: 14px 18px; margin-bottom: 12px; }
.mt-os b { display: block; font-size: 14px; color: #eef1f6; margin-bottom: 6px; }
.mt-os p { font-size: 12.5px; color: #aab4c8; margin: 0; }
.mt-link { color: #4f8cff; text-decoration: none; font-size: 13.5px; }
.mt-link:hover { text-decoration: underline; }
