:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #1d2733;
  --muted: #667085;
  --line: #d8dee9;
  --brand: #2563eb;
  --brand-dark: #1745b8;
  --soft: #e8f0ff;
  --shadow: 0 14px 34px rgba(18, 32, 56, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 34px clamp(20px, 5vw, 64px) 24px;
  background: linear-gradient(135deg, #ffffff 0%, #edf4ff 100%);
  border-bottom: 1px solid var(--line);
}

.topbar-main {
  display: grid;
  gap: 14px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid #c8d7ff;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--brand-dark);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.site-nav a:hover {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.12;
}

.site-intro {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.nowrap {
  white-space: nowrap;
}

.stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stat-pill {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
  font-size: 14px;
}

.stat-pill strong {
  color: var(--text);
}

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  padding: 24px clamp(20px, 5vw, 64px) 48px;
}

.filters {
  position: sticky;
  top: 16px;
  align-self: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.search {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.search input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  outline: none;
}

.search input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13);
}

.category-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.category-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.category-button:hover,
.category-button.active {
  border-color: #bfd0ff;
  background: var(--soft);
  color: var(--brand-dark);
}

.category-button span:last-child {
  color: var(--muted);
  font-size: 13px;
}

.knowledge-panel {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.filter-title {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.knowledge-list,
.knowledge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.knowledge-list {
  display: grid;
}

.knowledge-button,
.knowledge-chip {
  border: 1px solid #c8d7ff;
  border-radius: 999px;
  background: #f5f8ff;
  color: var(--brand-dark);
  cursor: pointer;
  font: inherit;
}

.knowledge-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  text-align: left;
}

.knowledge-button.active,
.knowledge-button:hover,
.knowledge-chip:hover {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.knowledge-chip {
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
}

.knowledge-row {
  margin: 12px 0 2px;
}

.tutorial-panel {
  display: grid;
  gap: 10px;
  margin-top: 22px;
  padding: 14px;
  border: 1px solid #c8d7ff;
  border-radius: 8px;
  background: #f6f9ff;
}

.tutorial-kicker {
  margin-bottom: -2px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
}

.tutorial-panel h2 {
  margin-bottom: 0;
  font-size: 16px;
  line-height: 1.35;
}

.tutorial-panel p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.tutorial-button {
  width: 100%;
  margin-top: 2px;
}

.notice-panel {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #f2c98b;
  border-radius: 8px;
  background: #fff8ed;
}

.notice-kicker {
  margin-bottom: -2px;
  color: #b45309;
  font-size: 13px;
  font-weight: 800;
}

.notice-panel h2 {
  margin-bottom: 0;
  font-size: 16px;
  line-height: 1.35;
}

.notice-panel p {
  margin-bottom: 0;
  color: #7c4a12;
  font-size: 13px;
  line-height: 1.65;
}

.content {
  min-width: 0;
}

.content-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.content-head h2 {
  margin-bottom: 0;
  font-size: 24px;
}

.content-head p {
  margin-bottom: 0;
  color: var(--muted);
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(18, 32, 56, 0.06);
}

.card-image {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 0;
  background: #e8edf5;
  cursor: zoom-in;
  font: inherit;
  overflow: hidden;
  padding: 0;
  text-align: left;
}

.card-image:hover img,
.detail-image-button:hover img {
  filter: brightness(1.04);
  transform: scale(1.01);
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
  display: block;
  transition: filter 160ms ease, transform 160ms ease;
}

.category-tag {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
}

.card-body {
  padding: 15px;
}

.card h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.card p {
  color: var(--muted);
  line-height: 1.58;
}

.file-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 14px;
}

.file-badge {
  padding: 4px 7px;
  border-radius: 6px;
  background: #f0f4f8;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.button:hover {
  transform: translateY(-1px);
}

.empty {
  padding: 32px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  text-align: center;
}

.detail-dialog {
  width: min(860px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.detail-dialog::backdrop {
  background: rgba(8, 15, 25, 0.48);
}

.dialog-close {
  position: absolute;
  right: 12px;
  top: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: #f1f5f9;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
}

.detail {
  display: grid;
  grid-template-columns: minmax(260px, 42%) minmax(0, 1fr);
  gap: 20px;
  padding: 24px;
}

.detail img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fc;
}

.detail-image-button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  padding: 0;
}

.detail-image-button img {
  display: block;
  transition: filter 160ms ease, transform 160ms ease;
}

.image-dialog {
  width: min(1120px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.image-dialog::backdrop {
  background: rgba(8, 15, 25, 0.76);
}

.image-close {
  position: fixed;
  right: max(18px, calc((100vw - 1120px) / 2));
  top: 18px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.image-preview {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 20px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.image-preview img {
  width: 100%;
  max-height: calc(100vh - 112px);
  object-fit: contain;
  border-radius: 6px;
  background: #f8fafc;
  cursor: zoom-in;
  transition: transform 120ms ease-out;
  will-change: transform;
}

.image-preview figcaption {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.detail-list {
  display: grid;
  gap: 10px;
}

.free-note {
  margin: 2px 0 14px;
  padding: 10px 12px;
  border: 1px solid #f2c98b;
  border-radius: 8px;
  background: #fff8ed;
  color: #7c4a12;
  font-size: 13px;
  line-height: 1.6;
}

.download-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.download-row span {
  overflow-wrap: anywhere;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

@media (max-width: 820px) {
  .topbar,
  .content-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .filters {
    position: static;
  }

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