/* ============ 基础重置 ============ */
:root {
  --bg: #f4f5fb;
  --card: #ffffff;
  --ink: #1c2033;
  --ink-2: #5a6178;
  --ink-3: #9aa1b6;
  --line: #e8eaf2;
  --brand: #6366f1;
  --brand-2: #8b5cf6;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(38, 44, 86, 0.08);
  --shadow-lg: 0 14px 40px rgba(38, 44, 86, 0.14);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
svg { display: block; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

/* ============ 首页 Hero ============ */
.hero {
  position: relative;
  padding: calc(28px + var(--safe-top)) 22px 30px;
  background: linear-gradient(150deg, #6366f1 0%, #8b5cf6 48%, #a855f7 100%);
  color: #fff;
  border-radius: 0 0 30px 30px;
  overflow: hidden;
}

.hero__glow {
  position: absolute;
  width: 260px;
  height: 260px;
  right: -80px;
  top: -90px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.4), transparent 68%);
  border-radius: 50%;
  pointer-events: none;
}

.hero__glow::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  left: -220px;
  top: 150px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 70%);
  border-radius: 50%;
}

.hero__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

.hero__logo {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.hero__badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(6px);
}

.hero__title {
  position: relative;
  z-index: 1;
  margin-top: 22px;
  font-size: 30px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.hero__title span {
  background: linear-gradient(90deg, #fef08a, #fde68a, #fff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__sub {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.86);
}

.hero__stats {
  position: relative;
  z-index: 1;
  margin-top: 22px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  padding: 14px 8px;
  backdrop-filter: blur(8px);
}

.stat { text-align: center; flex: 1; }
.stat b { display: block; font-size: 22px; font-weight: 800; }
.stat span { font-size: 11px; color: rgba(255, 255, 255, 0.82); }
.stat-line { width: 1px; height: 26px; background: rgba(255, 255, 255, 0.25); }

/* ============ 首页主体 ============ */
.home-main {
  padding: 24px 16px 10px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 6px 14px;
}

.section-head h2 { font-size: 18px; font-weight: 800; }
.section-head span { font-size: 12px; color: var(--ink-3); }

.course-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.course-card {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 16px 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s;
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.course-card:active {
  transform: scale(0.96);
  box-shadow: var(--shadow-lg);
}

.course-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.course-card__icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 24px;
  color: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
}

.course-card__en {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-3);
}

.course-card__name {
  margin-top: 12px;
  font-size: 17px;
  font-weight: 800;
}

.course-card__desc {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-2);
  min-height: 34px;
}

.course-card__foot {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-3);
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}

.course-card__bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  border-radius: 0 6px 6px 0;
}

/* 学习提示 */
.study-tip {
  margin: 22px 2px 8px;
  display: flex;
  gap: 12px;
  background: linear-gradient(135deg, #eef2ff, #faf5ff);
  border: 1px solid #e5e9ff;
  border-radius: var(--radius);
  padding: 16px;
}

.study-tip__icon { font-size: 22px; line-height: 1.2; }
.study-tip b { font-size: 14px; }
.study-tip p { margin-top: 4px; font-size: 12.5px; color: var(--ink-2); }

/* ============ 课程页 Hero ============ */
.course-hero {
  position: relative;
  padding: calc(18px + var(--safe-top)) 22px 26px;
  color: #fff;
  border-radius: 0 0 28px 28px;
  overflow: hidden;
  background: linear-gradient(150deg, #6366f1, #8b5cf6);
}

.course-hero::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -70px;
  top: -80px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.32), transparent 70%);
  border-radius: 50%;
}

.course-hero__back {
  position: relative;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
}

.course-hero__icon {
  position: relative;
  z-index: 1;
  margin-top: 6px;
  font-size: 40px;
  line-height: 1;
}

.course-hero__title {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  font-size: 26px;
  font-weight: 800;
}

.course-hero__desc {
  position: relative;
  z-index: 1;
  margin-top: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.88);
  max-width: 90%;
}

.course-hero__meta {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  font-size: 11px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.26);
  backdrop-filter: blur(6px);
}

/* ============ Tabs ============ */
.tabs-wrap {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 12px 0 10px;
  background: linear-gradient(to bottom, var(--bg) 76%, rgba(244, 245, 251, 0));
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 2px;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(38, 44, 86, 0.05);
}

.tab.is-active {
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.32);
}

/* ============ 知识卡 ============ */
.points {
  padding: 6px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.6);
  animation: rise 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.card__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 16px 14px;
  width: 100%;
  text-align: left;
  background: none;
}

.card__idx {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  margin-top: 2px;
}

.card__title {
  flex: 1;
  display: block;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.4;
  min-width: 0;
}

.card__sub {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
}

.card__toggle {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--ink-3);
  margin-top: 2px;
  transition: transform 0.3s, background 0.2s, color 0.2s;
}

.card.is-open .card__toggle {
  transform: rotate(180deg);
  color: #fff;
}

.card__body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

.card__inner {
  padding: 0 16px 18px;
}

/* 记忆钩子 */
.hook {
  display: flex;
  gap: 10px;
  background: linear-gradient(135deg, #fff7ed, #fef2f2);
  border: 1px dashed #fdba74;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.hook__icon { font-size: 17px; line-height: 1.4; }
.hook__label {
  font-size: 11px;
  font-weight: 800;
  color: #ea580c;
  letter-spacing: 0.5px;
}
.hook__text {
  font-size: 13.5px;
  color: #7c2d12;
  margin-top: 2px;
  line-height: 1.62;
}

/* 详解行 */
.rows { display: flex; flex-direction: column; gap: 11px; }

.row { display: flex; gap: 10px; }

.row__key {
  flex: 0 0 auto;
  min-width: 58px;
  font-size: 11.5px;
  font-weight: 800;
  color: #fff;
  border-radius: 8px;
  padding: 3px 8px;
  text-align: center;
  height: fit-content;
  margin-top: 1px;
  letter-spacing: 0.3px;
}

.row__val {
  flex: 1;
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.7;
  min-width: 0;
}

.row__val b { color: #111827; }
.row__val em {
  font-style: normal;
  background: linear-gradient(to top, #fef08a 42%, transparent 42%);
  padding: 0 1px;
  font-weight: 600;
}

.kv-list { display: flex; flex-direction: column; gap: 6px; }

.kv {
  display: flex;
  gap: 8px;
  font-size: 13px;
  line-height: 1.65;
}

.kv__k {
  flex: 0 0 auto;
  font-weight: 700;
  color: var(--brand);
}

.eg {
  border-left: 3px solid var(--line);
  padding: 2px 0 2px 10px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.68;
}

.eg + .eg { margin-top: 6px; }
.eg b { color: var(--ink); }
.eg i { font-style: italic; color: #9333ea; }

/* 折叠提示 */
.card__more {
  margin-top: 12px;
  font-size: 12px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ============ 回到顶部 ============ */
.to-top {
  position: fixed;
  right: 18px;
  bottom: calc(22px + var(--safe-bottom));
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #fff;
  color: var(--brand);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all 0.28s;
  z-index: 50;
}

.to-top.is-show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.to-top:active { transform: scale(0.9); }

/* ============ 底部 ============ */
.foot {
  text-align: center;
  padding: 18px 20px calc(30px + var(--safe-bottom));
  font-size: 11.5px;
  color: var(--ink-3);
}

/* ============ 空状态 ============ */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-3);
  font-size: 13px;
}

/* ============ 词库 ============ */
.vocab-bar {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.vocab-count {
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.7;
}

.vocab-count b {
  font-size: 17px;
  color: var(--brand);
  font-weight: 800;
  margin: 0 2px;
}

.vocab-search {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.vocab-search:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.vocab-search__icon { font-size: 13px; opacity: 0.6; }

.vocab-search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  padding: 11px 0;
  color: var(--ink);
  font-family: inherit;
  min-width: 0;
}

.vocab-search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.letter-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 14px 2px 4px;
  scrollbar-width: none;
}

.letter-nav::-webkit-scrollbar { display: none; }

.letter {
  flex: 0 0 auto;
  min-width: 32px;
  height: 32px;
  padding: 0 9px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: all 0.18s;
}

.letter.is-active {
  color: #fff;
  background: var(--brand);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.32);
}

.letter:active { transform: scale(0.92); }

.word-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.word {
  background: var(--card);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 3px 12px rgba(38, 44, 86, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.6);
  animation: rise 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.word__top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.word__n {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-3);
  background: var(--bg);
  border-radius: 6px;
  padding: 1px 6px;
  align-self: center;
}

.word__w {
  font-size: 16.5px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: 0.2px;
}

.word__p {
  font-size: 12px;
  color: var(--ink-3);
}

.word__pos {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--brand);
  background: #eef0ff;
  border-radius: 6px;
  padding: 1px 7px;
  align-self: center;
}

.word__m {
  margin-top: 5px;
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.6;
}

.word__h {
  margin-top: 8px;
  display: flex;
  gap: 7px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #7c2d12;
  background: linear-gradient(135deg, #fff7ed, #fef2f2);
  border: 1px dashed #fdba74;
  border-radius: 10px;
  padding: 8px 10px;
}

.word__h-icon { flex: 0 0 auto; font-size: 13px; }

.vocab-more {
  padding: 18px 0 6px;
  text-align: center;
}

.load-more {
  width: 100%;
  padding: 14px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(150deg, #6366f1, #8b5cf6);
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
  transition: transform 0.18s;
}

.load-more:active { transform: scale(0.97); }

.vocab-end {
  font-size: 12px;
  color: var(--ink-3);
}

/* ============ 小屏适配 ============ */
@media (max-width: 340px) {
  .course-grid { grid-template-columns: 1fr; }
  .hero__title { font-size: 26px; }
}
