html { min-height: 100%; }

body.prepost-chapter-page {
  margin: 0;
  min-height: 100vh;
  color: #111827;
  background:
    linear-gradient(rgba(17, 24, 39, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 24, 39, 0.035) 1px, transparent 1px),
    #f7f8fb;
  background-size: 32px 32px, 32px 32px, auto;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: 0;
}

.prepost-chapter-page * { box-sizing: border-box; }
.prepost-chapter-page a { color: inherit; text-decoration: none; }
.prepost-chapter-page button { font: inherit; }

.prepost-chapter-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 28px;
  border-bottom: 1px solid #dce3ee;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.prepost-chapter-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.prepost-chapter-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #2458ff;
  font-weight: 900;
  flex: 0 0 auto;
}

.prepost-chapter-brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.15;
}

.prepost-chapter-brand p {
  margin: 2px 0 0;
  color: #667085;
  font-size: 12px;
}

.prepost-chapter-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.prepost-chapter-btn,
.prepost-chapter-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid #dce3ee;
  border-radius: 8px;
  background: #fff;
  color: #233044;
  padding: 8px 12px;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease;
}

.prepost-chapter-btn-primary {
  border-color: #1d4ed8;
  background: #2458ff;
  color: #fff;
  font-weight: 900;
}

.prepost-chapter-btn:hover,
.prepost-chapter-btn-primary:hover {
  transform: translateY(-1px);
  border-color: #94a3b8;
}

.prepost-chapter-shell {
  width: min(1460px, calc(100vw - 40px));
  margin: 22px auto 36px;
  display: grid;
  gap: 18px;
}

.prepost-chapter-hero {
  position: relative;
  overflow: hidden;
  min-height: 264px;
  border: 1px solid #dce3ee;
  border-radius: 8px;
  background: #0a1220;
  box-shadow: 0 18px 46px -36px rgba(15, 23, 42, .44);
}

.prepost-chapter-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .54;
  filter: saturate(1.04) contrast(1.02);
}

.prepost-chapter-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(8, 15, 29, .9), rgba(8, 15, 29, .46), rgba(8, 15, 29, .16));
}

.prepost-chapter-hero-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 24px;
  align-items: end;
  min-height: 264px;
  padding: 24px;
  color: #fff;
}

.prepost-chapter-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 900;
  color: #8fb1ff;
}

.prepost-chapter-hero h2 {
  margin: 0;
  max-width: 860px;
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1.04;
  letter-spacing: 0;
}

.prepost-chapter-hero p {
  margin: 12px 0 0;
  max-width: 760px;
  color: rgba(255, 255, 255, .84);
  font-size: 15px;
  line-height: 1.8;
}

.prepost-chapter-hero-side {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 8px;
  background: rgba(255, 255, 255, .12);
  padding: 14px;
  backdrop-filter: blur(12px);
}

.prepost-chapter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  width: fit-content;
  max-width: 100%;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  padding: 5px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.prepost-chapter-chipwrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prepost-chapter-card,
.prepost-chapter-route,
.prepost-chapter-resource,
.prepost-chapter-sidecard,
.prepost-chapter-panel {
  border: 1px solid #dce3ee;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 40px -32px rgba(15, 23, 42, .36);
}

.prepost-chapter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 420px);
  gap: 16px;
  align-items: start;
}

.prepost-chapter-main {
  display: grid;
  gap: 16px;
}

.prepost-chapter-fusion {
  border: 1px solid #dce3ee;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(248, 250, 252, .98));
  box-shadow: 0 16px 40px -32px rgba(15, 23, 42, .36);
  padding: 16px;
}

.prepost-chapter-fusion-head {
  display: grid;
  gap: 8px;
}

.prepost-chapter-fusion-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
}

.prepost-chapter-fusion-head h3 {
  margin: 0;
  font-size: 18px;
}

.prepost-chapter-fusion-head p {
  margin: 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.65;
}

.prepost-chapter-fusion-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.prepost-chapter-fusion-cell {
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.prepost-chapter-fusion-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-bottom: 8px;
  border-radius: 999px;
  background: #eef3ff;
  color: #2458ff;
  font-size: 11px;
  font-weight: 900;
}

.prepost-chapter-fusion-cell b {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: #101828;
}

.prepost-chapter-fusion-cell span:last-child {
  display: block;
  color: #667085;
  font-size: 12px;
  line-height: 1.65;
}

.prepost-chapter-panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #e8edf4;
  background: #fbfcff;
}

.prepost-chapter-panel-head h3 {
  margin: 0;
  font-size: 18px;
}

.prepost-chapter-panel-head span {
  color: #667085;
  font-size: 12px;
}

.prepost-chapter-route-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.prepost-chapter-route {
  overflow: hidden;
}

.prepost-chapter-route.pre { border-top: 4px solid #2458ff; }
.prepost-chapter-route.post { border-top: 4px solid #0f8f87; }

.prepost-chapter-route-head {
  padding: 14px 15px;
  border-bottom: 1px solid #edf1f6;
  background: #fbfcff;
}

.prepost-chapter-route-head h4 {
  margin: 0;
  font-size: 17px;
}

.prepost-chapter-route-head p {
  margin: 6px 0 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.6;
}

.prepost-chapter-tasklist {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.prepost-chapter-task {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 10px;
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  padding: 12px;
}

.prepost-chapter-tasklabel {
  color: #2458ff;
  font-size: 12px;
  font-weight: 900;
}

.prepost-chapter-task:nth-child(2n) .prepost-chapter-tasklabel { color: #0f8f87; }

.prepost-chapter-task h5 {
  margin: 0 0 6px;
  font-size: 15px;
}

.prepost-chapter-task p {
  margin: 0 0 6px;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.65;
}

.prepost-chapter-open {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #2458ff;
  font-size: 13px;
  font-weight: 900;
}

.prepost-chapter-lessonlist {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.prepost-chapter-lesson {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  padding: 12px;
}

.prepost-chapter-lesson.is-current {
  border-color: #93c5fd;
  background: #f8fbff;
}

.prepost-chapter-lesson-no {
  color: #2458ff;
  font-size: 13px;
  font-weight: 900;
}

.prepost-chapter-lesson strong {
  display: block;
  font-size: 15px;
}

.prepost-chapter-lesson span {
  display: block;
  margin-top: 4px;
  color: #667085;
  font-size: 12px;
  line-height: 1.55;
}

.prepost-chapter-resourcegrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
}

.prepost-chapter-resource {
  display: grid;
  gap: 7px;
  min-height: 126px;
  padding: 13px;
}

.prepost-chapter-resource-type {
  color: #0f8f87;
  font-size: 12px;
  font-weight: 900;
}

.prepost-chapter-resource strong {
  font-size: 15px;
  line-height: 1.35;
}

.prepost-chapter-resource p {
  margin: 0;
  color: #667085;
  font-size: 12px;
  line-height: 1.6;
}

.prepost-chapter-side {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 86px;
}

.prepost-chapter-sidecard {
  overflow: hidden;
}

.prepost-chapter-sidebody {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.prepost-chapter-sideitem {
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  padding: 12px;
}

.prepost-chapter-sideitem b {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
}

.prepost-chapter-sideitem span {
  display: block;
  color: #667085;
  font-size: 12px;
  line-height: 1.6;
}

.prepost-chapter-links {
  display: grid;
  gap: 8px;
}

.prepost-chapter-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
}

.prepost-chapter-empty {
  padding: 18px;
  color: #667085;
  line-height: 1.7;
}

.prepost-section-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 900;
}

.prepost-section-focus {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.prepost-section-focus-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.prepost-section-focus-label {
  color: #2458ff;
  font-size: 12px;
  font-weight: 900;
}

.prepost-section-focus-text {
  color: #4b5563;
  font-size: 13px;
  line-height: 1.72;
}

@media (max-width: 1120px) {
  .prepost-chapter-grid {
    grid-template-columns: 1fr;
  }

  .prepost-chapter-side {
    position: static;
  }

  .prepost-chapter-resourcegrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .prepost-chapter-fusion-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .prepost-chapter-topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 16px;
  }

  .prepost-chapter-nav {
    justify-content: flex-start;
  }

  .prepost-chapter-shell {
    width: min(100vw - 24px, 1460px);
    margin-top: 14px;
  }

  .prepost-chapter-hero-content {
    grid-template-columns: 1fr;
    align-items: start;
    padding: 18px;
  }

  .prepost-chapter-route-grid,
  .prepost-chapter-resourcegrid,
  .prepost-chapter-fusion-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .prepost-chapter-task,
  .prepost-chapter-lesson,
  .prepost-section-focus-row {
    grid-template-columns: 1fr;
  }
}
