:root {
  color-scheme: dark;
  --bg: #0c1118;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.1);
  --text: #eef3f8;
  --muted: #9aa9b8;
  --accent: #7dd3a8;
  --accent-2: #82aaff;
  --danger: #ff9f9f;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

html.light {
  color-scheme: light;
  --bg: #f5f7f9;
  --panel: rgba(255, 255, 255, 0.85);
  --panel-strong: #ffffff;
  --border: rgba(20, 40, 60, 0.12);
  --text: #16222e;
  --muted: #5c6b7a;
  --accent: #138a5b;
  --accent-2: #3a68c8;
  --danger: #b83232;
  --shadow: 0 18px 40px rgba(30, 50, 70, 0.1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(125, 211, 168, 0.12), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(130, 170, 255, 0.12), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  line-height: 1.55;
  overflow-x: hidden;
}

.orb { position: fixed; border-radius: 50%; filter: blur(90px); opacity: .16; pointer-events: none; }
.orb-one { width: 320px; height: 320px; background: var(--accent); top: 40%; left: -160px; }
.orb-two { width: 260px; height: 260px; background: var(--accent-2); top: 60%; right: -120px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1180px; margin: 0 auto; padding: 22px 24px;
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #07120d; font-weight: 800; font-size: 22px; box-shadow: var(--shadow);
}
.brand-text { font-weight: 700; font-size: 19px; letter-spacing: .2px; }
.brand-text small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.topnav { display: flex; gap: 8px; }
.ghost {
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  padding: 8px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
  text-decoration: none; transition: background .2s, transform .2s;
}
.ghost:hover { background: var(--panel-strong); transform: translateY(-1px); }

main { max-width: 1180px; margin: 0 auto; padding: 40px 24px 64px; }
.hero { text-align: center; max-width: 820px; margin: 0 auto 44px; }
.eyebrow { color: var(--accent); font-size: 11px; letter-spacing: 2.2px; font-weight: 700; }
h1 { font-size: clamp(34px, 6vw, 62px); line-height: 1.08; margin: 14px 0 18px; letter-spacing: -2px; }
h1 em { font-style: normal; background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: var(--muted); font-size: 16px; max-width: 660px; margin: 0 auto 28px; }

.searchbar {
  display: flex; align-items: center; gap: 10px; max-width: 700px; margin: 0 auto;
  padding: 8px 8px 8px 18px; border-radius: 18px;
  background: var(--panel-strong); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.searchbar:focus-within { border-color: var(--accent); }
.search-icon { color: var(--muted); font-size: 24px; line-height: 1; }
.searchbar input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--text); font-size: 16px; padding: 10px 0;
}
.searchbar button {
  border: 0; border-radius: 12px; padding: 12px 24px; cursor: pointer; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #07120d;
}
.searchbar button:disabled { opacity: .55; cursor: wait; }

.chips { display: flex; justify-content: center; gap: 8px; margin: 18px 0 14px; }
.chip {
  border: 1px solid var(--border); background: var(--panel); color: var(--muted);
  border-radius: 999px; padding: 7px 18px; cursor: pointer; font-size: 14px;
}
.chip.active { color: var(--text); border-color: var(--accent); background: var(--panel-strong); }
.toolrow { display: flex; justify-content: center; align-items: center; gap: 18px; flex-wrap: wrap; }
.status { color: var(--muted); font-size: 13px; }
.linkbtn { border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.card {
  display: flex; gap: 14px; padding: 16px; border-radius: 18px;
  background: var(--panel); border: 1px solid var(--border);
  transition: transform .2s, border-color .2s, background .2s;
  animation: rise .35s ease both;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); background: var(--panel-strong); }
.cover {
  flex: 0 0 86px; height: 122px; border-radius: 10px; overflow: hidden;
  background: linear-gradient(150deg, rgba(125,211,168,.35), rgba(130,170,255,.35));
  display: grid; place-items: center; font-size: 30px; font-weight: 800; color: rgba(255,255,255,.85);
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.card-body { min-width: 0; flex: 1; }
.meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--panel-strong); border: 1px solid var(--border); color: var(--muted); }
.badge.kind { color: var(--accent); }
.card h3 { font-size: 15px; line-height: 1.3; margin: 0 0 4px; }
.authors { color: var(--muted); font-size: 12px; margin: 0 0 6px; }
.desc { color: var(--muted); font-size: 12px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.actions a { color: var(--accent-2); font-size: 12px; text-decoration: none; font-weight: 600; }
.actions a:hover { text-decoration: underline; }

.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty-mark { font-size: 46px; color: var(--accent); }
.empty h2 { color: var(--text); margin: 8px 0; }
.errors { margin-top: 24px; padding: 14px 18px; border-radius: 14px; border: 1px solid rgba(255,159,159,.35); color: var(--danger); font-size: 13px; background: rgba(255,159,159,.06); }

footer { max-width: 1180px; margin: 0 auto; padding: 10px 24px 40px; color: var(--muted); font-size: 13px; }
footer details { border-top: 1px solid var(--border); padding: 16px 0; }
footer summary { cursor: pointer; color: var(--text); }
.footer-body { max-width: 760px; }
code { background: var(--panel-strong); padding: 2px 6px; border-radius: 6px; font-size: 12px; }
.legal { margin-bottom: 0; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) {
  main { padding: 26px 16px 48px; }
  .searchbar { padding-left: 12px; }
  .searchbar button { padding: 12px 16px; }
  .card { flex-direction: column; }
  .cover { flex-basis: auto; width: 100%; height: 150px; }
}
