:root {
  color-scheme: light;
  --page: #f6f8f6;
  --surface: #ffffff;
  --ink: #202828;
  --muted: #64706f;
  --soft: #7f8b89;
  --line: #d8dfdc;
  --accent: #c95732;
  --focus: #b74726;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #151a1a;
  --surface: #1b2221;
  --ink: #edf2ef;
  --muted: #b0bbb7;
  --soft: #87938f;
  --line: #36413f;
  --accent: #ed825c;
  --focus: #f09a7a;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  transition: background-color 160ms ease, color 160ms ease;
}

a { color: inherit; }

button,
input,
select { font: inherit; }

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.page-shell {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 0 24px;
}

.topbar {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: 16px;
  font-weight: 760;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--soft);
  font-size: 12px;
  white-space: nowrap;
}

.topnav a,
.text-button {
  color: inherit;
  text-decoration: none;
  transition: color 140ms ease;
}

.topnav a:hover,
.topnav a:focus-visible,
.text-button:hover,
.text-button:focus-visible {
  color: var(--accent);
}

.text-button,
.reset-button {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

main { padding: 48px 0 72px; }

.list-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

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

h1 {
  margin-bottom: 5px;
  font-size: 34px;
  font-weight: 760;
  letter-spacing: -0.035em;
  line-height: 1.1;
  text-wrap: balance;
}

.list-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.result-count {
  color: var(--soft) !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
  gap: 24px;
  margin-top: 30px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.search-field,
.select-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--soft);
  font-size: 11px;
  white-space: nowrap;
}

.search-field input,
.select-field select {
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

.search-field input {
  width: 100%;
  padding: 0 10px;
}

.search-field input::placeholder { color: var(--soft); }

.search-field input:focus,
.select-field select:focus { border-color: var(--accent); }

.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.select-field select { width: 106px; padding: 0 7px; }

.reset-button {
  color: var(--soft);
  font-size: 11px;
  white-space: nowrap;
}

.reset-button:hover { color: var(--accent); }

.resource-list { border-top: 0; }

.resource-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.resource-content { min-width: 0; }

.resource-title {
  margin: 0;
  font-size: 17px;
  font-weight: 720;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.resource-title a {
  text-decoration: none;
  text-underline-offset: 3px;
}

.resource-title a:hover { color: var(--accent); }

.resource-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 5px 0 3px;
  color: var(--soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  line-height: 1.4;
}

.resource-meta span + span::before {
  margin: 0 8px;
  color: var(--line);
  content: "/";
}

.resource-summary {
  display: -webkit-box;
  overflow: hidden;
  max-width: 76ch;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.resource-actions {
  display: flex;
  align-items: center;
  gap: 13px;
  white-space: nowrap;
}

.resource-link {
  color: var(--accent);
  font-size: 11px;
  text-decoration: none;
}

.resource-link + .resource-link { color: var(--muted); }

.resource-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.mention-details {
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
}

.mention-details summary {
  display: inline-block;
  cursor: pointer;
  color: var(--accent);
}

.mention-list {
  display: grid;
  gap: 7px;
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
}

.mention-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: baseline;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.mention-label {
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
}

.mention-description {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mention-link {
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.mention-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.loading-list span {
  display: block;
  height: 60px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--line) 35%, transparent), transparent);
  background-size: 160px 100%;
  animation: loading 1.2s ease-in-out infinite;
}

.empty-state,
.error-state {
  padding: 42px 0;
  color: var(--muted);
  font-size: 13px;
}

.empty-state p,
.error-state p { margin-bottom: 14px; }

.button {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 11px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
}

.button:hover { border-color: var(--accent); color: var(--accent); }

.error-state span {
  display: block;
  margin-bottom: 14px;
  color: var(--soft);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0 24px;
  border-top: 1px solid var(--line);
  color: var(--soft);
  font-size: 10px;
}

.footer a { color: inherit; text-decoration: none; }
.footer a:hover { color: var(--accent); }

[hidden] { display: none !important; }

@keyframes loading {
  0% { background-position: -160px 0; }
  100% { background-position: 160px 0; }
}

@media (max-width: 860px) {
  .toolbar { grid-template-columns: 1fr; gap: 12px; }
  .filter-row { flex-wrap: wrap; }
}

@media (max-width: 600px) {
  .page-shell { padding: 0 16px; }
  .topbar { min-height: 58px; align-items: flex-start; padding: 15px 0; }
  .topnav { flex-wrap: wrap; justify-content: flex-end; gap: 6px 12px; }
  .topnav > span { display: none; }
  main { padding: 34px 0 52px; }
  .list-heading { display: block; }
  .result-count { margin-top: 12px; }
  .toolbar { margin-top: 22px; }
  .filter-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .select-field { justify-content: space-between; }
  .select-field select { width: 100%; }
  .reset-button { justify-self: start; }
  .resource-row { display: block; padding: 15px 0; }
  .resource-summary { -webkit-line-clamp: 2; }
  .resource-actions { margin-top: 10px; }
  .mention-list li { grid-template-columns: 1fr auto; }
  .mention-description { grid-column: 1 / -1; grid-row: 2; white-space: normal; }
  .footer { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
