:root {
  --bg: #0b1220;
  --panel: #131c2e;
  --line: #243049;
  --text: #e6edf7;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #a78bfa;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  padding-bottom: 72px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
main { max-width: 860px; margin: 0 auto; padding: 16px; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: rgba(11, 18, 32, .92);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(8px);
}
.brand { font-weight: 700; color: var(--text); letter-spacing: .5px; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; }
.page-head h1 { margin: 8px 0 4px; font-size: 26px; }
.muted { color: var(--muted); }
.topic { margin-top: 28px; font-size: 18px; color: var(--accent-2); border-left: 3px solid var(--accent-2); padding-left: 10px; }
.card, .chunk {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; margin: 12px 0;
}
.card h3 { margin: 0 0 6px; font-size: 17px; line-height: 1.45; }
.card h3 a { color: var(--text); }
.meta { color: var(--muted); font-size: 13px; margin: 4px 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.tags span {
  font-size: 12px; color: var(--accent); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 9px;
}
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bookmark {
  background: transparent; color: var(--accent); border: 1px solid var(--accent);
  border-radius: 999px; padding: 4px 12px; cursor: pointer; white-space: nowrap;
}
.bookmark.active { background: var(--accent); color: #04121f; }
.search-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.search-form input[type=search], .search-form select, textarea, input[type=password] {
  flex: 1 1 200px; background: #0e1728; color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 15px;
}
button[type=submit], .login button {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04121f; font-weight: 700; border: 0; border-radius: 10px;
  padding: 10px 18px; cursor: pointer;
}
.snippet { color: #cbd5e1; }
.abstract { white-space: pre-wrap; }
.chunk p { margin: 6px 0; white-space: pre-wrap; }
.links { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(15, 23, 42, .96); border-top: 1px solid var(--line);
  padding: 10px 0 max(10px, env(safe-area-inset-bottom));
}
.bottomnav a { text-align: center; color: var(--muted); font-size: 14px; }
.bottomnav a:hover { color: var(--accent); }
.empty { color: var(--muted); text-align: center; margin: 40px 0; }
.answer { margin-top: 18px; }
.error { color: #f87171; }
.login-body { display: grid; place-items: center; min-height: 100vh; padding-bottom: 0; }
.login { width: min(360px, 90vw); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.login h1 { font-size: 22px; margin-top: 0; }
.login form { display: flex; flex-direction: column; gap: 10px; }
code { background: #0e1728; padding: 1px 5px; border-radius: 5px; }
@media (max-width: 480px) {
  main { padding: 12px; }
  .page-head h1 { font-size: 22px; }
}
