:root {
  color-scheme: light;
  --paper: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #edf3fa;
  --ink: #192638;
  --muted: #68778a;
  --quiet: #8a96a6;
  --line: #e0e7ef;
  --blue: #3173cc;
  --coral: #e97159;
  --teal: #328f85;
  --yellow: #e4ae36;
  --purple: #8877c4;
  --radius: 8px;
  --font-display: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
}

button, input, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid #79a8e7;
  outline-offset: 2px;
}

.topbar {
  height: 62px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  width: 25px;
  height: 25px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  transform: rotate(-8deg);
}

.brand-mark i { display: block; border-radius: 2px; background: var(--blue); }
.brand-mark i:nth-child(2) { background: var(--coral); }
.brand-mark i:nth-child(3) { background: var(--yellow); }
.brand-mark i:nth-child(4) { background: var(--teal); }

.topbar-right { display: flex; align-items: center; gap: 22px; }
.topbar-note { color: var(--quiet); font-size: 12px; }
.source-link { color: var(--muted); text-decoration: none; font-size: 12px; }
.source-link:hover { color: var(--blue); }
.source-link span { margin-left: 3px; color: var(--blue); }

.app-layout {
  min-height: calc(100vh - 62px);
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: calc(100vh - 62px);
  padding: 25px 15px 18px 20px;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  border-right: 1px solid var(--line);
}

.sidebar-heading { padding: 0 10px 14px; }
.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sidebar-heading h2 { margin: 0; font-size: 15px; font-weight: 680; }
.category-list { display: grid; gap: 3px; }

.category-button {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  display: grid;
  grid-template-columns: 9px 1fr auto;
  align-items: center;
  gap: 10px;
  color: #4d5b6d;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.category-button:hover { background: #edf2f8; color: var(--ink); }
.category-button.is-active { background: #e6eef8; color: #1d4e88; font-weight: 650; }
.category-color { width: 8px; height: 8px; flex: none; border-radius: 2px; background: var(--category-color, var(--blue)); }
.category-color-all { background: linear-gradient(135deg, var(--blue) 0 25%, var(--coral) 25% 50%, var(--yellow) 50% 75%, var(--teal) 75%); }
.category-count { color: #91a0b0; font-family: var(--font-mono); font-size: 11px; }

.sidebar-note {
  margin: auto 4px 12px;
  padding: 13px 12px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.note-mark { width: 9px; height: 9px; margin-top: 4px; flex: none; border-radius: 50%; background: var(--yellow); }
.sidebar-note p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.sidebar-note strong { color: var(--ink); font-weight: 650; }
.sidebar-foot { margin: 0 10px; color: var(--quiet); font-size: 11px; }
.sidebar-foot strong { color: var(--ink); font-family: var(--font-mono); }

.main-content { min-width: 0; padding: 20px 24px 22px; }
.hero {
  position: relative;
  min-height: 237px;
  max-width: 1370px;
  margin: 0 auto 26px;
  padding: 27px 34px;
  display: grid;
  grid-template-columns: minmax(310px, 0.95fr) minmax(260px, 0.85fr);
  align-items: center;
  overflow: hidden;
  background: #eaf2fb;
  border: 1px solid #e1ebf5;
  border-radius: 8px;
}
.hero-copy { position: relative; z-index: 1; max-width: 520px; }
.hero .eyebrow { margin-bottom: 9px; }
.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 31px;
  line-height: 1.3;
  font-weight: 740;
}
.hero h1 span { color: var(--blue); }
.hero-description { max-width: 415px; margin: 11px 0 17px; color: #586b80; font-size: 13px; }
.hero-meta { display: flex; align-items: center; gap: 11px; color: #66788d; font-size: 11px; }
.hero-meta strong { color: var(--ink); font-family: var(--font-mono); font-size: 15px; }
.meta-divider { width: 1px; height: 14px; background: #bdcddd; }
.hero-art { height: 205px; min-width: 0; display: flex; justify-content: flex-end; align-items: center; }
.hero-art img { display: block; width: min(100%, 390px); max-height: 225px; object-fit: contain; mix-blend-mode: multiply; }

.catalog { max-width: 1370px; margin: 0 auto; }
.catalog-heading { margin: 0 0 15px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.catalog-heading .eyebrow { margin-bottom: 2px; }
.catalog-heading h2 { margin: 0; font-size: 20px; line-height: 1.35; font-weight: 710; }
.view-switch { display: inline-flex; padding: 3px; background: #e8edf4; border-radius: 7px; }
.view-tab {
  min-height: 34px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #657286;
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
}
.view-tab.is-active { color: var(--ink); background: #fff; box-shadow: 0 1px 3px #25364a1b; font-weight: 650; }
.view-tab span { color: #8997a8; font-family: var(--font-mono); font-size: 10px; }

.filter-panel {
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(430px, 1.35fr);
  align-items: end;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.search-field {
  min-width: 0;
  height: 42px;
  padding: 0 11px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #d9e1ea;
  border-radius: 6px;
  background: #fff;
}
.search-glyph { position: relative; width: 14px; height: 14px; flex: none; border: 1.7px solid #8391a2; border-radius: 50%; }
.search-glyph::after { position: absolute; width: 6px; height: 1.7px; right: -4px; bottom: -2px; content: ""; background: #8391a2; transform: rotate(45deg); transform-origin: left center; }
.search-field input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 13px; }
.search-field input::placeholder { color: #9aa5b2; }
.search-field kbd { padding: 1px 6px; color: #8794a4; background: #f3f6f9; border: 1px solid #e3e8ef; border-radius: 4px; font: 11px var(--font-mono); }
.filter-controls { display: grid; grid-template-columns: repeat(3, minmax(105px, 1fr)); gap: 9px; }
.select-field, .sort-field { min-width: 0; display: grid; gap: 4px; color: #7c899a; font-size: 10px; }
.select-field select, .sort-field select {
  width: 100%;
  min-width: 0;
  height: 31px;
  padding: 0 25px 0 8px;
  color: #405066;
  background-color: #f8fafc;
  border: 1px solid #e0e6ed;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
}

.result-toolbar { min-height: 45px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.result-toolbar > p { margin: 0; color: #69788b; font-size: 12px; }
.result-actions { display: flex; align-items: center; gap: 14px; }
.text-button { padding: 4px 0; color: var(--blue); background: transparent; border: 0; cursor: pointer; font-size: 11px; }
.sort-field { display: flex; align-items: center; gap: 8px; }
.sort-field select { width: auto; height: 28px; padding-left: 7px; font-size: 11px; }

.review-note {
  margin: 0 0 14px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: #fff9e9;
  border: 1px solid #f1e5c8;
  border-radius: 6px;
}
.review-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--yellow); }
.review-note p { margin: 0; color: #726343; font-size: 11px; }

.resource-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.resource-card {
  min-width: 0;
  min-height: 232px;
  padding: 13px 14px 12px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 2px solid var(--category-color, var(--blue));
  border-radius: 7px;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}
.resource-card:hover { border-color: #c8d5e3; box-shadow: 0 5px 16px #20344a0b; transform: translateY(-1px); }
.resource-topline { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.source-meta { display: inline-flex; align-items: center; gap: 7px; }
.verification-label { padding: 2px 5px; color: #8a6731; background: #fff5df; border-radius: 3px; font-size: 9px; white-space: nowrap; }
.resource-category { display: inline-flex; align-items: center; gap: 7px; color: #6a788a; font-size: 10px; }
.source-number { color: #9aa5b1; font-family: var(--font-mono); font-size: 9px; }
.resource-title { margin: 10px 0 0; overflow-wrap: anywhere; font-family: var(--font-display); font-size: 15px; line-height: 1.35; font-weight: 710; }
.resource-host { margin: 2px 0 8px; color: #8a97a7; overflow-wrap: anywhere; font: 10px var(--font-mono); }
.resource-description { margin: 0 0 8px; color: #59687a; font-size: 12px; line-height: 1.55; }
.resource-note { margin: 2px 0 8px; padding: 6px 8px; color: #705e35; background: #fff9e9; border-left: 2px solid var(--yellow); font-size: 10px; line-height: 1.5; }
.resource-tags { margin-top: auto; padding: 7px 0 10px; display: flex; flex-wrap: wrap; gap: 5px; }
.resource-tag { max-width: 100%; padding: 3px 6px; overflow-wrap: anywhere; border-radius: 4px; color: #657487; background: #f1f4f8; font-size: 9px; line-height: 1.35; }
.stage-tag { color: #526b87; background: #edf3f9; }
.language-tag { color: #686581; background: #f1f0f8; }
.free-tag { color: #2e756a; background: #eaf5f2; }
.mixed-tag { color: #9a6840; background: #fbf1e7; }
.check-tag { color: #8a6731; background: #fff5df; }
.resource-footer { min-height: 30px; padding-top: 7px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #edf0f4; }
.open-resource { display: inline-flex; align-items: center; gap: 5px; color: var(--blue); text-decoration: none; font-size: 11px; font-weight: 650; }
.open-resource:hover { color: #1b4e91; }
.external-arrow { font-size: 13px; }
.save-button { padding: 4px 3px; color: #78879a; background: transparent; border: 0; cursor: pointer; font-size: 10px; }
.save-button:hover, .save-button.is-saved { color: #9b6a14; }
.save-button.is-saved { font-weight: 650; }

.empty-state { min-height: 260px; padding: 36px 20px; display: grid; place-content: center; justify-items: center; text-align: center; background: #fff; border: 1px dashed #ccd7e3; border-radius: var(--radius); }
.empty-mark { width: 30px; height: 30px; margin-bottom: 8px; display: grid; place-items: center; color: var(--blue); background: #eaf2fb; border-radius: 50%; font-family: var(--font-display); font-weight: 700; }
.empty-state h3 { margin: 0; font-size: 15px; }
.empty-state p { margin: 5px 0 12px; color: var(--muted); font-size: 12px; }
.clear-button { padding: 7px 12px; color: #fff; background: var(--blue); border: 0; border-radius: 5px; cursor: pointer; font-size: 11px; }
.page-footer { margin: 17px 0 0; padding: 12px 2px 0; display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); color: #8491a0; font-size: 10px; }
.page-footer p { margin: 0; }
.page-footer a { color: #677b94; text-decoration: none; white-space: nowrap; }
.page-footer a:hover { color: var(--blue); }
.noscript { margin: 20px; padding: 12px; color: #713b35; background: #fff0ed; border-radius: 6px; }

@media (min-width: 1600px) {
  .app-layout { grid-template-columns: 252px minmax(0, 1fr); }
  .main-content { padding-right: 32px; padding-left: 32px; }
  .hero { min-height: 255px; padding-right: 42px; padding-left: 42px; }
  .hero-art { height: 220px; }
  .resource-grid { gap: 14px; }
}

@media (max-width: 1120px) {
  .app-layout { grid-template-columns: 208px minmax(0, 1fr); }
  .main-content { padding-right: 18px; padding-left: 18px; }
  .hero { grid-template-columns: minmax(280px, 1fr) minmax(210px, 0.8fr); padding-right: 22px; padding-left: 25px; }
  .hero h1 { font-size: 28px; }
  .filter-panel { grid-template-columns: 1fr; }
  .resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .topbar { height: 56px; padding: 0 16px; }
  .app-layout { min-height: calc(100vh - 56px); display: block; }
  .sidebar { position: static; min-height: 0; padding: 12px 14px 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-heading { display: none; }
  .category-list { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; }
  .category-button { width: auto; min-height: 34px; padding: 0 10px; display: inline-flex; flex: 0 0 auto; gap: 7px; background: #fff; border: 1px solid var(--line); }
  .category-button.is-active { background: #e6eef8; border-color: #ccdaea; }
  .category-count { font-size: 10px; }
  .sidebar-note, .sidebar-foot { display: none; }
  .main-content { padding: 14px 14px 18px; }
  .hero { min-height: 196px; margin-bottom: 20px; padding: 20px 18px; grid-template-columns: minmax(0, 1fr) 34%; }
  .hero h1 { font-size: 25px; }
  .hero-description { max-width: 350px; font-size: 12px; }
  .hero-art { height: 155px; }
  .hero-art img { max-height: 160px; }
  .catalog-heading { align-items: flex-start; flex-direction: column; gap: 11px; }
  .catalog-heading h2 { font-size: 18px; }
  .view-switch { align-self: stretch; }
  .view-tab { flex: 1; justify-content: center; }
  .filter-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .result-toolbar { align-items: flex-start; padding: 10px 0; }
  .result-actions { gap: 9px; }
  .resource-grid { gap: 9px; }
  .resource-card { min-height: 224px; padding: 12px; }
}

@media (max-width: 540px) {
  .topbar-note { display: none; }
  .topbar-right { gap: 0; }
  .hero { display: block; min-height: 0; padding: 19px 17px 0; }
  .hero-copy { max-width: none; }
  .hero h1 { font-size: 26px; }
  .hero-description { max-width: 310px; margin-top: 8px; margin-bottom: 12px; }
  .hero-art { height: 128px; margin-top: -5px; justify-content: flex-end; }
  .hero-art img { width: 205px; max-height: 136px; }
  .filter-panel { padding: 9px; gap: 9px; }
  .filter-controls { grid-template-columns: 1fr 1fr; }
  .select-field:last-child { grid-column: span 2; }
  .select-field select { height: 34px; }
  .result-toolbar { align-items: center; }
  .result-actions { gap: 8px; }
  .sort-field { gap: 4px; }
  .sort-field span { display: none; }
  .sort-field select { max-width: 108px; }
  .resource-grid { grid-template-columns: 1fr; }
  .resource-card { min-height: 0; }
  .resource-tags { margin-top: 3px; }
  .page-footer { flex-direction: column; }
}

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