:root {
  color-scheme: light;
  --bg: #f2f4f7;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #627182;
  --line: #dce3ea;
  --accent: #0b7a75;
  --navy: #17324d;
  --soft: #eaf4f3;
  --paper: #2e75b6;
  --code: #f28e2b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

a { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(18px, 4vw, 48px);
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font-weight: 800;
}

.brand strong,
.brand small { display: block; }
.brand small { color: var(--muted); font-size: 12px; margin-top: 2px; }

nav { display: flex; gap: 16px; font-size: 14px; }
nav a { text-decoration: none; color: var(--muted); }
nav a:hover { color: var(--accent); }

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  min-height: 430px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, .8fr);
  gap: 28px;
  align-items: center;
  padding: 58px 0 34px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  font-size: 13px;
}

h1, h2, h3 { margin: 0; letter-spacing: 0; }
h1 { font-size: clamp(34px, 5vw, 58px); line-height: 1.06; color: var(--navy); }
h2 { font-size: 28px; color: var(--navy); }
h3 { font-size: 17px; line-height: 1.35; }

.lead {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border-radius: 7px;
  border: 1px solid var(--line);
  text-decoration: none;
  font-weight: 700;
}
.button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.button.ghost { background: #fff; color: var(--navy); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.stat-card {
  min-height: 118px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(23, 50, 77, .08);
}
.stat-card strong { display: block; font-size: 34px; color: var(--navy); }
.stat-card span { color: var(--muted); font-size: 14px; }

.library, .about {
  margin: 24px 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.library-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: end;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 130px 130px 130px;
  gap: 10px;
}

input, select {
  height: 40px;
  padding: 0 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 122, 117, .12);
}

.result-summary {
  margin: 16px 0;
  color: var(--muted);
  font-size: 14px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.item-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.item-card:hover {
  border-color: rgba(11, 122, 117, .45);
}

.item-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.62;
  font-size: 14px;
}

.meta, .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f8fafc;
}
.tag.paper { color: var(--paper); border-color: rgba(46,117,182,.25); background: rgba(46,117,182,.08); }
.tag.code { color: #9b5607; border-color: rgba(242,142,43,.35); background: rgba(242,142,43,.12); }
.tag.pdf { color: #0b6f55; border-color: rgba(11,122,117,.24); background: rgba(11,122,117,.08); }

.links { display: flex; gap: 12px; flex-wrap: wrap; font-size: 14px; font-weight: 700; }
.links a { color: var(--accent); text-decoration: none; }
.links a:hover { text-decoration: underline; }

.about p {
  color: var(--muted);
  line-height: 1.75;
  max-width: 900px;
}

@media (max-width: 860px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .hero { grid-template-columns: 1fr; padding-top: 36px; }
  .library-head { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
}
