:root {
  --bg: #f6f6f3;
  --card: #ffffff;
  --text: #1d1d1b;
  --muted: #6d6d66;
  --border: #e2e2dc;
  --accent: #0f766e;
  --accent-soft: #d9f0ed;
  --seed: #15803d;
  --leech: #b45309;
  --shadow: 0 1px 2px rgba(20, 20, 15, 0.06), 0 4px 14px rgba(20, 20, 15, 0.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px);
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.logo { font-size: 20px; }

main { max-width: 900px; margin: 0 auto; padding: 28px 20px 60px; }

.hero h1 { font-size: 30px; margin: 6px 0 4px; }
.subtitle { color: var(--muted); margin: 0 0 22px; }

.searchbox { display: flex; gap: 8px; }
.searchbox input {
  flex: 1;
  font-size: 16px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
}
.searchbox input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}
.filters label { display: flex; flex-direction: column; gap: 4px; }
.filters select, .filters input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 14px;
}
.filters input { width: 120px; }

.hidden { display: none !important; }

.status { margin: 18px 0; padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.status.info { background: var(--accent-soft); color: var(--accent); }
.status.error { background: #fee2e2; color: #b91c1c; }
@media (prefers-color-scheme: dark) {
  .status.error { background: #3a1616; color: #fca5a5; }
}

.results-count { color: var(--muted); font-size: 14px; margin: 18px 0 10px; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0; font-size: 16px; font-weight: 650; cursor: pointer; }
.card h2:hover { color: var(--accent); }

.meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; font-size: 13px; }
.badge {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.badge.size { font-variant-numeric: tabular-nums; }
.date { margin-left: auto; color: var(--muted); font-size: 12px; align-self: center; }

.actions { display: flex; gap: 10px; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 24px 0; color: var(--muted); }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal-box {
  background: var(--card);
  color: var(--text);
  border-radius: 14px;
  padding: 22px;
  max-width: 620px;
  width: 100%;
  max-height: 85vh;
  overflow: auto;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}
.modal-box h2 { margin: 0 24px 12px 0; font-size: 18px; }
.modal-grid { display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; font-size: 14px; margin-bottom: 18px; }
.modal-grid .k { color: var(--muted); }
.modal-grid .v { word-break: break-all; font-variant-numeric: tabular-nums; }
.files-head { color: var(--muted); margin-top: 14px; }
.files { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; margin-bottom: 14px; }
.file-row { display: flex; justify-content: space-between; gap: 16px; font-size: 13px; }
.file-row span:first-child { word-break: break-all; }
.file-row span:last-child { color: var(--muted); white-space: nowrap; }

/* Midnight editorial theme */
:root {
  color-scheme: dark;
  --bg: #100e12; --card: #1b171d; --text: #f3eaf0; --muted: #ad9eaa;
  --border: #352a33; --accent: #ee7b9a; --accent-soft: #38202d;
  --shadow: none;
}
body { background: radial-gradient(ellipse at 80% 5%, #3c182940, transparent 48%), var(--bg); }
.topbar { position: relative; padding: 23px max(6vw, 24px); background: transparent; }
.brand { color: var(--text); text-decoration: none; font-size: 19px; letter-spacing: 2px; }
.brand small { display: block; font-size: 9px; color: var(--muted); letter-spacing: 2px; margin-top: 3px; }
.logo { font-family: Georgia, serif; font-size: 38px; line-height: 1; letter-spacing: -4px; margin-right: 12px; }
.logo span { color: var(--accent); }
.age-badge { color: var(--accent); border: 1px solid #674052; border-radius: 6px; padding: 5px 9px; font-size: 12px; }
.age-badge span { color: var(--muted); margin-left: 8px; }
main { max-width: 1080px; padding: 64px 28px 70px; }
.hero { padding-bottom: 46px; }
.eyebrow { color: var(--muted); font-size: 10px; letter-spacing: 3px; display: flex; align-items: center; gap: 10px; }
.eyebrow span { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 14px #ed789c; }
.hero h1 { font-size: clamp(36px, 5vw, 58px); line-height: 1.35; letter-spacing: -1px; margin: 20px 0 16px; font-weight: 600; }
.hero h1 span { color: var(--accent); }
.subtitle { margin-bottom: 30px; font-size: 14px; letter-spacing: 1px; }
.searchbox { background: #211a22; border: 1px solid #59404f; padding: 7px; border-radius: 12px; box-shadow: 0 8px 50px #ed789c09; }
.searchbox input { min-width: 0; border: 0; background: transparent; padding: 13px; }
.btn { border-radius: 7px; transition: background .15s, border-color .15s; justify-content: center; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #26111b; padding-inline: 27px; }
#modal .btn.primary{ background: var(--accent); border-color: var(--accent); color: #1c1520; padding-inline: 27px; }
.btn:hover:not(:disabled) { background: var(--accent-soft); }
.btn.primary:hover { background: #f69eb6; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.filters { gap: 18px; margin-top: 22px; }
.filters label { gap: 7px; font-size: 11px; }
.filters input, .filters select { background: #171319; }
.section-heading { display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); padding: 0 0 17px; font-size: 17px; }
.section-heading small { color: var(--accent); font-size: 9px; letter-spacing: 2px; margin-left: 13px; }
.index-note { font-size: 12px; color: var(--muted); }
.results-count { font-size: 12px; margin: 20px 0; }
.card { padding: 23px 25px; border-radius: 10px; margin-bottom: 12px; background: linear-gradient(110deg, #211a22, #19151c); }
.card h2 { line-height: 1.7; overflow-wrap: anywhere; font-weight: 500; }
.meta { margin: 15px 0; }
.badge { border: 0; background: #ffffff06; border-radius: 4px; font-size: 11px; padding: 3px 8px; }
.badge.size { color: #edabc0; background: #ed789c10; }
.actions .btn { font-size: 12px; padding: 7px 12px; }
.actions .btn:first-child { color: var(--accent); border-color: #68404f; }
.pagination { margin-top: 32px; font-size: 13px; }
.status.error { background: #3a161f; color: #ffb1c6; }
.modal { background: #08050bba; backdrop-filter: blur(8px); }
.modal-box { border: 1px solid #5a394d; padding: 32px; box-shadow: 0 20px 100px #0008; }
.modal-box h2 { overflow-wrap: anywhere; }
.gate { max-width: 460px; text-align: center; padding: 45px 30px; }
.gate-icon { font-size: 27px; color: var(--accent); margin-bottom: 20px; }
.gate h2 { margin-right: 0; font-size: 25px; }
.gate p { color: var(--muted); font-size: 14px; line-height: 1.9; }
.gate .btn { margin-top: 16px; }
footer { max-width: 1024px; margin: 0 auto; padding: 26px 28px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }
footer > span { letter-spacing: 2px; } footer b { color: var(--accent); } footer p { line-height: 1.9; }
@media (max-width: 600px) {
  .topbar { padding: 18px 20px; } .age-badge span { display: none; }
  main { padding: 38px 18px 45px; } .hero { padding-bottom: 32px; }
  .searchbox input { font-size: 14px; padding: 10px 7px; } .btn.primary { padding-inline: 18px; }
  .filters { gap: 12px; } .filters input { width: 100px; }
  .index-note { display: none; } .card { padding: 19px 16px; }
  .date { width: 100%; margin-left: 0; } .pagination { gap: 10px; } .pagination .btn { padding: 9px 12px; }
  .modal-grid { grid-template-columns: 65px 1fr; } .modal-box { padding: 26px 20px; }
}

.search-about { margin-top: 48px; border-top: 1px solid var(--border); padding-top: 24px; color: var(--muted); font-size: 13px; line-height: 1.9; }
.search-about h2 { font-size: 16px; color: var(--text); font-weight: 500; }

.card h2 a { color: inherit; text-decoration: none; }
.card h2 a:hover, main nav a, main > a { color: var(--accent); }
.detail-page { margin-top: 24px; }
.detail-page h1 { font-size: clamp(23px, 4vw, 34px); overflow-wrap: anywhere; }
.detail-page dd { margin: 0; overflow-wrap: anywhere; }
.detail-page .files { padding-left: 0; list-style: none; }

.actions { flex-wrap: wrap; }
.detail-page h2 { cursor: default; margin-top: 24px; }
