:root {
  --bg: #f4f1ea;
  --panel: #fffdf9;
  --panel-strong: #ffffff;
  --line: #d9d5ca;
  --line-soft: #ebe7dc;
  --text: #1d2738;
  --muted: #6f7a88;
  --faint: #9aa3ad;
  --ink-blue: #3e5d87;
  --jade: #2f7d6b;
  --cinnabar: #ad4b3f;
  --gold: #a8792d;
  --plum: #7a536f;
  --shadow: 0 1px 2px rgba(29, 39, 56, .04), 0 12px 34px rgba(29, 39, 56, .07);
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.45), transparent 280px),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 14px;
  line-height: 1.65;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid rgba(62, 93, 135, .32);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255,253,249,.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 12px 28px 0;
}

.topline {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 54px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 310px;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 1px solid rgba(173,75,63,.28);
  border-radius: 7px;
  background: #fff;
  object-fit: cover;
  box-shadow: 0 1px 2px rgba(29,39,56,.05);
}

.brand-copy strong { display: block; font-size: 15px; letter-spacing: .01em; }
.brand-copy small { display: block; margin-top: 1px; color: var(--muted); font-size: 11.5px; }

.search {
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(520px, 100%);
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--faint);
}

.search svg { width: 17px; height: 17px; flex: 0 0 auto; }
.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.top-actions { margin-left: auto; }

.ghost-btn,
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
}
.ghost-btn svg { width: 16px; height: 16px; }
.ghost-btn:hover { border-color: #c9c2b4; color: var(--text); }

.grade-tabs {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 12px 0 10px;
  scrollbar-width: none;
}
.grade-tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}
.tab:hover { background: #f7f3ea; color: var(--text); }
.tab.active {
  background: var(--ink-blue);
  border-color: var(--ink-blue);
  color: #fff;
  font-weight: 600;
}

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px 28px 54px;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr);
  gap: 30px;
  overflow: hidden;
  min-height: 238px;
  padding: 30px 32px;
  border: 1px solid #d8d5ca;
  border-radius: var(--radius);
  background:
    linear-gradient(112deg, rgba(255,253,249,.98) 0%, rgba(247,241,231,.96) 62%, rgba(237,232,221,.92) 100%);
  box-shadow: var(--shadow);
}

.hero::before {
  content: "语";
  position: absolute;
  right: 23%;
  bottom: -88px;
  color: rgba(62,93,135,.055);
  font-family: "Songti SC", "STSong", serif;
  font-size: 260px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.hero-copy { position: relative; z-index: 1; }
.hero-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid rgba(173,75,63,.22);
  border-radius: 999px;
  background: #fff8f3;
  color: var(--cinnabar);
  font-size: 12px;
  font-weight: 600;
}
.hero h1 {
  margin: 14px 0 12px;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(27px, 3vw, 40px);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: .01em;
}
.hero p {
  max-width: 720px;
  margin: 0;
  color: #5f6b7a;
  font-size: 14px;
}
.hero-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.hero-tags span {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  color: #5d6878;
  font-size: 12px;
}

.hero-stats {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-self: center;
  overflow: hidden;
  border: 1px solid rgba(217,213,202,.9);
  border-radius: var(--radius);
  background: rgba(255,255,255,.74);
}
.stat-card {
  min-width: 0;
  padding: 20px 12px;
  text-align: center;
}
.stat-card + .stat-card { border-left: 1px solid var(--line-soft); }
.stat-card strong { display: block; font-size: 25px; line-height: 1.15; }
.stat-card span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }

.section { margin-top: 30px; }
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 15px;
}
.section-head h2 { margin: 0 0 3px; font-size: 20px; line-height: 1.35; }
.section-head p { margin: 0; color: var(--muted); font-size: 13px; }
.section-stat { display: flex; gap: 18px; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.section-stat strong { color: var(--text); font-size: 16px; margin-right: 2px; }

.featured-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.featured-card {
  position: relative;
  overflow: hidden;
  min-height: 154px;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(29,39,56,.03);
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.featured-card .fc-cover {
  height: 82px;
  margin: -18px -18px 14px;
  border-bottom: 1px solid var(--line-soft);
  background-image:
    linear-gradient(180deg, rgba(29,39,56,.04), rgba(29,39,56,.38)),
    var(--cover);
  background-position: center;
  background-size: cover;
}
.featured-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--tone, var(--ink-blue));
}
.featured-card:hover {
  transform: translateY(-2px);
  border-color: #c8c2b6;
  box-shadow: var(--shadow);
}
.fc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fc-badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tone, var(--ink-blue)) 10%, white);
  color: var(--tone, var(--ink-blue));
  font-size: 12px;
  font-weight: 600;
}
.fc-count { color: var(--muted); font-size: 12px; }
.featured-card h3 { margin: 15px 0 5px; font-size: 17px; line-height: 1.4; }
.featured-card p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.fc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 15px;
  color: var(--tone, var(--ink-blue));
  font-size: 12.5px;
  font-weight: 600;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,253,249,.74);
}
.toolbar label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.toolbar select {
  height: 34px;
  min-width: 128px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}
.toolbar-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}
.toolbar-note svg { width: 15px; height: 15px; flex: 0 0 auto; }

.category-filters { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 15px; }
.filter-chip {
  height: 31px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12.5px;
}
.filter-chip:hover { border-color: #c8c2b6; color: var(--text); }
.filter-chip.active {
  border-color: var(--ink-blue);
  background: var(--ink-blue);
  color: #fff;
  font-weight: 600;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.category-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 252px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(29,39,56,.025);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.category-card:hover {
  transform: translateY(-2px);
  border-color: #c8c2b6;
  box-shadow: var(--shadow);
}
.category-cover {
  position: relative;
  height: 104px;
  overflow: hidden;
  padding: 15px 15px 12px;
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--tone, var(--ink-blue)) 13%, white),
      color-mix(in srgb, var(--tone, var(--ink-blue)) 4%, #fffdf9));
}
.category-cover.has-image {
  background-image:
    linear-gradient(180deg, rgba(24,31,43,.04), rgba(24,31,43,.72)),
    var(--cover);
  background-position: center;
  background-size: cover;
}
.category-cover.has-image .category-icon {
  border-color: rgba(255,255,255,.42);
  background: rgba(255,255,255,.86);
}
.category-cover.has-image .category-group {
  background: rgba(255,255,255,.86);
}
.category-cover.has-image h3 {
  color: #fff;
  text-shadow: 0 1px 8px rgba(17,24,39,.48);
}
.category-cover.has-image::after {
  color: rgba(255,255,255,.16);
}
.category-cover::after {
  content: attr(data-mark);
  position: absolute;
  right: 10px;
  bottom: -24px;
  color: color-mix(in srgb, var(--tone, var(--ink-blue)) 9%, transparent);
  font-family: "Songti SC", "STSong", serif;
  font-size: 92px;
  font-weight: 700;
  line-height: 1;
}
.category-icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid color-mix(in srgb, var(--tone, var(--ink-blue)) 30%, white);
  border-radius: 7px;
  background: rgba(255,255,255,.8);
  color: var(--tone, var(--ink-blue));
}
.category-icon svg { width: 18px; height: 18px; }
.category-group {
  position: absolute;
  right: 14px;
  top: 15px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.78);
  color: var(--muted);
  font-size: 11.5px;
}
.category-cover h3 {
  position: absolute;
  left: 15px;
  bottom: 13px;
  z-index: 1;
  max-width: calc(100% - 30px);
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}
.category-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 9px;
  padding: 13px 15px 15px;
}
.category-desc {
  display: -webkit-box;
  min-height: 42px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.lesson-preview { display: flex; flex-wrap: wrap; gap: 5px; }
.lesson-preview span {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  height: 24px;
  padding: 0 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #f3f1ea;
  color: #667081;
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lesson-preview span.has-agent {
  border: 1px solid color-mix(in srgb, var(--tone, var(--ink-blue)) 22%, white);
  background: color-mix(in srgb, var(--tone, var(--ink-blue)) 7%, white);
  color: var(--tone, var(--ink-blue));
}
.category-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 3px;
  color: var(--muted);
  font-size: 12px;
}
.category-foot strong { color: var(--text); font-size: 14px; }
.open-category {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--tone, var(--ink-blue));
  font-weight: 600;
}
.open-category svg { width: 14px; height: 14px; }

.empty {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 220px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255,253,249,.5);
  color: var(--muted);
  text-align: center;
}
.empty svg { width: 28px; height: 28px; color: var(--faint); }
.empty strong { color: var(--text); }
.empty span { font-size: 12.5px; }

.drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(24,31,43,.32);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.drawer-mask.show { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  width: min(620px, 94vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: -18px 0 48px rgba(29,39,56,.13);
  transform: translateX(105%);
  transition: transform .22s ease;
}
.drawer.show { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 17px;
  border-bottom: 1px solid var(--line);
}
.drawer-eyebrow { display: inline-flex; margin-bottom: 4px; color: var(--drawer-tone, var(--ink-blue)); font-size: 12px; font-weight: 600; }
.drawer-head h2 { margin: 0; font-size: 20px; line-height: 1.35; }
.drawer-head p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
}
.icon-btn:hover { color: var(--text); border-color: #c8c2b6; }
.icon-btn svg { width: 17px; height: 17px; }
.drawer-body { flex: 1; overflow: auto; padding: 18px 22px 30px; }
.drawer-summary { margin: 0 0 17px; color: #5f6b7a; font-size: 13px; }
.drawer-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfaf6;
}
.drawer-stat { padding: 12px 10px; text-align: center; }
.drawer-stat + .drawer-stat { border-left: 1px solid var(--line-soft); }
.drawer-stat strong { display: block; font-size: 18px; }
.drawer-stat span { color: var(--muted); font-size: 11.5px; }
.drawer-section + .drawer-section { margin-top: 20px; }
.drawer-section h3 { margin: 0 0 9px; font-size: 14px; }
.grade-group {
  margin-bottom: 10px;
  padding: 12px 13px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #fff;
}
.grade-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.grade-group-head strong { font-size: 13px; }
.grade-group-head span { color: var(--muted); font-size: 11.5px; }
.lesson-list { display: flex; flex-wrap: wrap; gap: 6px; }
.lesson-item {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid #e4e0d6;
  border-radius: 999px;
  background: #fbfaf6;
  color: #5b6574;
  font-size: 12px;
}
.agent-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.agent-card {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 84px;
  overflow: hidden;
  padding: 8px 9px 8px 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #fff;
  color: inherit;
  text-decoration: none;
  transition: border-color .15s ease, transform .15s ease;
}
.agent-card:hover { border-color: var(--drawer-tone, var(--ink-blue)); transform: translateY(-1px); }
.agent-card-cover {
  display: block;
  width: 124px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 6px;
  background: #f1eee7;
}
.agent-card-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.agent-card-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: color-mix(in srgb, var(--drawer-tone, var(--ink-blue)) 9%, white);
  color: var(--drawer-tone, var(--ink-blue));
}
.agent-card-placeholder svg { width: 22px; height: 22px; }
.agent-card-copy { min-width: 0; flex: 1; }
.agent-card-copy strong,
.agent-card-copy small { display: block; }
.agent-card-copy strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.agent-card-copy small { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.agent-card-action { flex: 0 0 auto; color: var(--drawer-tone, var(--ink-blue)); font-size: 12px; font-weight: 600; }
.related-note {
  margin-top: 18px;
  padding: 12px 13px;
  border-left: 3px solid var(--drawer-tone, var(--ink-blue));
  background: #f8f6f0;
  color: var(--muted);
  font-size: 12.5px;
}

@media (max-width: 1180px) {
  .category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .featured-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .brand { min-width: 280px; }
}

@media (max-width: 870px) {
  .topbar-inner { padding: 11px 18px 0; }
  .page { padding: 18px 18px 42px; }
  .topline { flex-wrap: wrap; }
  .search { order: 3; width: 100%; }
  .top-actions { margin-left: auto; }
  .hero { grid-template-columns: 1fr; padding: 24px; }
  .hero-stats { width: 100%; }
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .featured-grid { grid-template-columns: 1fr 1fr; }
  .toolbar { flex-wrap: wrap; }
  .toolbar-note { width: 100%; margin-left: 0; }
}

@media (max-width: 560px) {
  .brand { min-width: 0; }
  .brand-copy strong { font-size: 14px; }
  .brand-copy small { display: none; }
  .ghost-btn { width: 38px; padding: 0; }
  .ghost-btn span { display: none; }
  .hero h1 { font-size: 28px; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
  .stat-card { padding: 15px 8px; }
  .stat-card strong { font-size: 21px; }
  .category-grid, .featured-grid { grid-template-columns: 1fr; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .section-stat { white-space: normal; }
  .toolbar label { width: 100%; justify-content: space-between; }
  .toolbar select { flex: 1; }
  .agent-list { grid-template-columns: 1fr; }
  .agent-card { grid-template-columns: 108px minmax(0, 1fr) auto; }
  .agent-card-cover { width: 108px; }
}
