
:root {
  --ink: #26333b;
  --paper: #ecefea;
  --paper-2: #f7f8f4;
  --line: #c8cec5;
  --seal: #a9402c;
  --moss: #5b6b4a;
  --brass: #b98a2f;
  --muted: #6b756f;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}
header {
  position: sticky; top: 0; z-index: 10;
  background: var(--paper-2);
  border-bottom: 2px solid var(--ink);
  padding: 12px 18px;
}
.topline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
h1 {
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: 22px; margin: 0; letter-spacing: 0;
}
.meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.nav a { color: var(--seal); text-decoration: none; font-size: 12px; margin-left: 10px; }
.nav a:hover { text-decoration: underline; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
input, select {
  font: inherit; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 0;
  padding: 6px 8px;
}
input[type=search] { min-width: 220px; flex: 1 1 240px; }
button {
  font: inherit; background: var(--ink); color: #fff; border: 0;
  padding: 6px 12px; cursor: pointer;
}
button:hover { background: var(--seal); }
main { padding: 18px; }
.countline { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
#locPanel { margin-bottom: 14px; }
.loc-crumbs { font-size: 13px; margin-bottom: 8px; }
.loc-crumb { background: none; border: 0; color: var(--ink); padding: 0; font: inherit; }
.loc-crumb:hover { color: var(--seal); text-decoration: underline; }
.loc-sep { color: var(--muted); }
.loc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.loc-chip { background: var(--paper-2); border: 1px solid var(--line); color: var(--ink); padding: 6px 10px; cursor: pointer; }
.loc-chip:hover { border-color: var(--seal); color: var(--seal); }
.loc-note { font-size: 12px; color: var(--muted); }
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.card {
  background: var(--paper-2); border: 1px solid var(--line);
  position: relative; cursor: pointer;
  display: flex; flex-direction: column;
}
.card:hover { border-color: var(--seal); }
.card .no {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  background: var(--seal); color: #fff;
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 10px; padding: 2px 5px;
}
.card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #d9ddd6; display: block; }
.card .ph { width: 100%; aspect-ratio: 4 / 3; background: #d9ddd6; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; }
.card .info { padding: 6px 8px; border-top: 1px solid var(--line); }
.card .nm { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .dt { font-family: Consolas, "Cascadia Code", monospace; font-size: 11px; color: var(--muted); }
.card .loc { font-family: Consolas, "Cascadia Code", monospace; font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
footer { padding: 16px 18px; font-size: 11px; color: var(--muted); }
.timeline { display: flex; flex-direction: column; gap: 8px; }
.trow {
  display: flex; gap: 10px; align-items: baseline;
  border-bottom: 1px solid var(--line); padding: 6px 0;
}
.trow .ym { font-family: "Songti SC", "STSong", serif; font-size: 18px; min-width: 90px; }
.trow .bar { height: 12px; background: var(--moss); }
.trow .cnt { font-family: Consolas, monospace; color: var(--muted); }
.period-head { display: flex; align-items: center; gap: 12px; margin: 18px 0 10px; }
.period-head h2 { font-family: "Songti SC", "STSong", serif; font-size: 18px; margin: 0; }
#periodGrid { margin-bottom: 20px; }
.lightbox {
  position: fixed; inset: 0; background: rgba(20, 26, 30, 0.88);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.lightbox.open { display: flex; }
.lb-card { background: #fff; max-width: 900px; width: 100%; padding: 14px; }
.lb-card img { width: 100%; max-height: 68vh; object-fit: contain; transition: transform .15s; }
.lb-tools { display: flex; gap: 8px; margin-top: 8px; }
.lb-meta { font-family: Consolas, "Cascadia Code", monospace; font-size: 12px; margin-top: 10px; overflow-wrap: anywhere; }
.lb-card { position: relative; }
.lb-close { position: absolute; top: 12px; right: 12px; z-index: 5; }
@media (max-width: 640px) {
  h1 { font-size: 18px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
}
