:root {
  --bg: #f6f8fb;
  --paper: #ffffff;
  --ink: #111827;
  --muted: #5d6675;
  --line: #dde3ec;
  --soft-line: #edf1f6;
  --shadow: 0 18px 48px rgba(18, 28, 45, .10);
  --radius: 8px;
  --max: 1160px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.brand-strip {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  height: 5px;
  background: linear-gradient(90deg, #2378ff 0%, #00a6a6 26%, #ff9a1f 50%, #6d5dfc 74%, #e84855 100%);
}

.site-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(221, 227, 236, .78);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(18px);
}

.topbar-inner {
  width: min(var(--max), calc(100% - 32px));
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

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

.brand img {
  width: clamp(118px, 20vw, 178px);
  height: auto;
  display: block;
}

.brand-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand-copy strong {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.brand-copy span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.icon-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: #172033;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.icon-button {
  width: 40px;
  padding: 0;
}

.text-button {
  padding: 0 15px;
}

.primary-button {
  border-color: transparent;
  background: var(--ink);
  color: #fff;
}

.official-button {
  border-color: #b9c4d3;
  background: #fff;
  color: #0f766e;
}

.official-button:hover {
  border-color: #0f766e;
  background: #ecfdf5;
}

.text-button svg,
.icon-button svg {
  width: 17px;
  height: 17px;
}

.main {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 64px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 26px;
  align-items: center;
  padding: 34px 0 28px;
}

.hero-copy {
  display: grid;
  grid-template-columns: minmax(420px, .9fr) minmax(0, 1.1fr);
  gap: 36px;
  align-items: end;
  max-width: none;
}

.hero-headline,
.hero-detail {
  display: grid;
  gap: 22px;
}

.hero h1 {
  max-width: none;
  margin: 0;
  font-size: clamp(42px, 5vw, 64px);
  font-weight: 800;
  letter-spacing: 0;
  line-height: .98;
  white-space: nowrap;
}

.hero p {
  max-width: none;
  margin: 0;
  color: #3f4858;
  font-size: clamp(15px, 1.55vw, 18px);
  line-height: 1.78;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

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

.signal {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px 14px 13px;
}

.signal strong {
  display: block;
  font-size: 22px;
  line-height: 1.1;
}

.signal span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 20px 0 18px;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(25px, 3.3vw, 38px);
  letter-spacing: 0;
  line-height: 1.15;
}

.section-head p {
  max-width: 510px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

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

.course-card {
  position: relative;
  display: grid;
  min-height: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(18, 28, 45, .06);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.course-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent), #ffffff 40%);
  box-shadow: 0 20px 38px rgba(18, 28, 45, .12);
}

.cover-frame {
  position: relative;
  background: #f0f3f8;
  overflow: hidden;
}

.cover-frame img {
  width: 100%;
  height: 132px;
  display: block;
  object-fit: contain;
  object-position: center;
  padding: 12px;
}

.course-number {
  position: absolute;
  left: 10px;
  top: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .92);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.card-body {
  display: grid;
  gap: 12px;
  padding: 15px;
}

.card-body h3 {
  min-height: 44px;
  margin: 0;
  font-size: 18px;
  line-height: 1.34;
  letter-spacing: 0;
}

.card-body p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.58;
}

.module-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.module-list span {
  border: 1px solid color-mix(in srgb, var(--accent), #ffffff 62%);
  border-radius: 6px;
  padding: 5px 7px;
  background: color-mix(in srgb, var(--accent), #ffffff 91%);
  color: color-mix(in srgb, var(--accent), #111827 30%);
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
}

.card-action {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  margin-top: 2px;
  border-top: 1px solid var(--soft-line);
  padding-top: 13px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
}

.card-action svg {
  width: 16px;
  height: 16px;
}

.info-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.info-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 20px;
}

.info-item h3 {
  margin: 0 0 9px;
  font-size: 18px;
}

.info-item p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.course-hero {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  margin: 30px 0 20px;
}

.course-cover {
  align-self: center;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.course-cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}

.course-summary {
  display: grid;
  gap: 18px;
}

.course-summary h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(34px, 6vw, 62px);
  line-height: 1.02;
  letter-spacing: 0;
}

.course-summary p {
  margin: 0;
  max-width: 760px;
  color: #3f4858;
  font-size: 17px;
  line-height: 1.78;
}

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

.meta-cell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
}

.meta-cell span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.meta-cell strong {
  display: block;
  margin-top: 7px;
  font-size: 14px;
  line-height: 1.38;
}

.reader-toolbar {
  position: sticky;
  top: 76px;
  z-index: 10;
  margin: 24px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.chapter-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 11px;
  scrollbar-width: none;
}

.chapter-scroll::-webkit-scrollbar {
  display: none;
}

.chapter-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 0 11px;
  color: #243044;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.chapter-link span {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.reader {
  display: grid;
  gap: 18px;
  max-width: 930px;
  margin: 0 auto;
}

.page-block {
  scroll-margin-top: 136px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
  box-shadow: 0 12px 34px rgba(18, 28, 45, .08);
}

.page-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  border-bottom: 1px solid var(--soft-line);
  padding: 0 14px;
}

.page-label strong {
  font-size: 14px;
  line-height: 1.3;
}

.page-label span {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.pdf-page {
  width: 100%;
  height: auto;
  display: block;
  background: #fff;
}

.bottom-actions {
  position: sticky;
  bottom: 0;
  z-index: 12;
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(18px);
}

.empty-state {
  min-height: 60vh;
  display: grid;
  place-items: center;
  text-align: center;
}

.empty-state h1 {
  margin: 0 0 12px;
}

.empty-state p {
  margin: 0 0 22px;
  color: var(--muted);
}

@media (max-width: 1080px) {
  .hero-copy {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .hero h1 {
    white-space: normal;
  }

  .course-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .topbar-inner {
    width: min(100% - 24px, var(--max));
    min-height: 68px;
  }

  .brand-copy {
    display: none;
  }

  .main {
    width: min(100% - 24px, var(--max));
    padding: 22px 0 58px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-top: 16px;
  }

  .hero-copy {
    gap: 24px;
  }

  .signal-row,
  .course-meta,
  .info-band {
    grid-template-columns: 1fr;
  }

  .section-head {
    display: grid;
    align-items: start;
  }

  .course-grid {
    grid-template-columns: 1fr;
  }

  .course-card {
    grid-template-columns: 116px 1fr;
  }

  .cover-frame img {
    height: 100%;
    min-height: 126px;
    aspect-ratio: auto;
  }

  .card-body h3 {
    min-height: 0;
    font-size: 17px;
  }

  .module-list span:nth-child(n+4) {
    display: none;
  }

  .course-hero {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .course-summary {
    order: -1;
  }

  .course-cover {
    max-width: 360px;
    margin: 0 auto;
  }

  .reader-toolbar {
    top: 68px;
    margin: 18px -4px 18px;
  }

  .bottom-actions {
    display: grid;
  }
}

@media (max-width: 480px) {
  .topbar-inner {
    min-height: 64px;
  }

  .brand img {
    width: 132px;
  }

  .nav-actions .text-button:not(.primary-button) {
    display: none;
  }

  .hero h1 {
    font-size: clamp(35px, 11vw, 46px);
  }

  .hero p,
  .course-summary p {
    font-size: 15px;
  }

  .hero-actions .text-button {
    width: 100%;
  }

  .course-card {
    grid-template-columns: 102px 1fr;
  }

  .card-body {
    gap: 10px;
    padding: 13px;
  }

  .card-body p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
  }

  .course-summary h1 {
    font-size: clamp(31px, 10vw, 42px);
  }

  .page-label {
    align-items: start;
    flex-direction: column;
    justify-content: center;
    padding: 9px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
