:root {
  color-scheme: light;
  --paper: #f7f4ed;
  --ink: #17201c;
  --muted: #6d746f;
  --line: #d8d1c3;
  --panel: #fffdf7;
  --red: #b63f35;
  --blue: #315c88;
  --sage: #dfe8d8;
  --gold: #c7983d;
  --shadow: 0 18px 34px rgba(55, 44, 30, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(23,32,28,.045) 1px, transparent 1px),
    linear-gradient(rgba(23,32,28,.035) 1px, transparent 1px),
    var(--paper);
  background-size: 26px 26px;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

a { color: inherit; text-decoration: none; }
img { display: block; width: 100%; }
h1, h2, h3, p { margin: 0; }
button, select { font: inherit; }

.topbar,
main,
.footer {
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  min-height: 72px;
  border-bottom: 2px solid var(--ink);
  background: rgba(247,244,237,.94);
  backdrop-filter: blur(12px);
}

.brand {
  padding: 8px 12px;
  color: #fff;
  background: var(--ink);
  font-size: 24px;
  font-weight: 900;
}

.nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav a,
.top-pill,
.hero-actions a,
.tabs button,
.keyword-band a,
.section-head a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--ink);
  background: var(--panel);
  font-weight: 800;
  white-space: nowrap;
}

.nav a.active,
.nav a:hover,
.top-pill,
.hero-actions a:first-child,
.tabs button.active,
.keyword-band a:nth-child(odd) {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  padding: 22px 0 0;
}

.hero-copy,
.hero-side,
.ranking,
.wall,
.channels article,
.library-hero,
.toolbar,
.catalog-card,
.detail-panel {
  border: 2px solid var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-copy {
  min-height: 390px;
  display: grid;
  align-content: center;
  padding: clamp(26px, 6vw, 74px);
}

.eyebrow {
  margin-bottom: 9px;
  color: var(--red);
  font-size: 13px;
  font-weight: 900;
}

.hero h1 {
  max-width: 9ch;
  margin-bottom: 16px;
  font-size: clamp(48px, 8vw, 108px);
  line-height: .92;
}

.hero-copy p:not(.eyebrow),
.library-hero p,
.detail-panel p,
.footer p {
  color: var(--muted);
  line-height: 1.78;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.hero-side {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--sage);
}

.hero-card {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 330px;
  background: var(--panel);
  border: 1px solid var(--ink);
}

.hero-card img {
  height: 260px;
  object-fit: cover;
}

.hero-card span,
.hero-note {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.hero-card b,
.content-card b,
.mini-item b,
.catalog-card b,
.rank-row b {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.hero-card small,
.content-card small,
.mini-item small,
.catalog-card small,
.rank-row small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.hero-note {
  color: #fff;
  background: var(--blue);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.metrics div {
  min-height: 86px;
  padding: 14px;
  border: 2px solid var(--ink);
  background: var(--panel);
}

.metrics b {
  display: block;
  color: var(--blue);
  font-size: 38px;
}

.metrics span {
  color: var(--muted);
  font-weight: 800;
}

.layout-grid {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.ranking,
.wall,
.channels article,
.library-hero,
.toolbar {
  padding: 16px;
}

.section-head {
  margin-bottom: 14px;
}

.section-head h2 {
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1.05;
}

.section-head.split {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
}

.rank-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.rank-row i {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #fff;
  background: var(--ink);
  font-style: normal;
  font-weight: 900;
}

.card-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 10px;
}

.content-card {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.content-card img {
  aspect-ratio: 2 / 3;
  object-fit: cover;
}

.content-card .tag {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 6px;
  color: #fff;
  background: var(--red);
  font-size: 12px;
  font-weight: 900;
}

.content-card b {
  min-height: 38px;
  display: -webkit-box;
  white-space: normal;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.35;
}

.channels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.channels article:nth-child(2) { background: #eef4fb; }
.channels article:nth-child(3) { background: #f9f0e7; }
.channels article:nth-child(4) { background: #eef3e8; }

.mini-list {
  display: grid;
  gap: 8px;
}

.mini-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 78px;
  padding: 7px;
  border: 1px solid var(--line);
  background: #fff;
}

.mini-item img {
  width: 54px;
  height: 68px;
  object-fit: cover;
}

.keyword-band {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.keyword-band a {
  min-height: 58px;
  border-width: 2px;
}

.library-hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  margin-top: 22px;
}

.library-hero h1,
.detail-panel h1 {
  margin-bottom: 8px;
  font-size: clamp(38px, 5vw, 72px);
  line-height: 1;
}

.library-hero strong {
  color: var(--red);
  font-size: 42px;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-top: 14px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.toolbar select {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--ink);
  background: #fff;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.catalog-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
  min-height: 112px;
  padding: 8px;
  box-shadow: none;
}

.catalog-card img {
  width: 74px;
  height: 96px;
  object-fit: cover;
}

.catalog-card em {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--red);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.catalog-card strong {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #fff;
  background: var(--blue);
}

.detail-panel {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 26px;
  align-items: center;
  margin-top: 22px;
  padding: 18px;
}

.detail-panel > img {
  width: 260px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.detail-meta span {
  padding: 8px 10px;
  border: 1px solid var(--ink);
  background: var(--sage);
  font-weight: 800;
}

.related-block {
  margin-top: 14px;
}

.footer {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 24px;
  margin-top: 34px;
  padding: 26px 0 38px;
  border-top: 2px solid var(--ink);
}

.footer b {
  font-size: 24px;
}

.footer h3 {
  margin: 0 0 10px;
  color: var(--red);
}

.footer a {
  display: block;
  margin: 8px 0;
  color: var(--muted);
}

.empty {
  padding: 24px;
  color: var(--muted);
}

@media (max-width: 1220px) {
  .layout-grid,
  .channels,
  .catalog-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .ranking {
    order: 2;
  }
}

@media (max-width: 820px) {
  .topbar,
  .hero,
  .layout-grid,
  .channels,
  .keyword-band,
  .library-hero,
  .toolbar,
  .catalog-grid,
  .detail-panel,
  .footer {
    grid-template-columns: 1fr;
  }
  .nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .top-pill {
    display: none;
  }
  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .library-hero,
  .toolbar {
    align-items: stretch;
  }
  .detail-panel > img {
    width: min(260px, 100%);
  }
}

@media (max-width: 520px) {
  .topbar,
  main,
  .footer {
    width: calc(100% - 22px);
  }
  .hero-copy,
  .ranking,
  .wall,
  .channels article,
  .library-hero,
  .toolbar,
  .detail-panel {
    padding: 12px;
  }
  .card-wall {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .catalog-card {
    grid-template-columns: 64px minmax(0, 1fr) 36px;
  }
  .catalog-card img {
    width: 64px;
    height: 84px;
  }
}
