:root {
  --bg: #f7f5f0;
  --ink: #1a1a1a;
  --muted: #666;
  --line: #d8d2c6;
  --head: #efeae1;
  --accent: #0f6b5c;
  --warn: #9a3412;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  font: 14px/1.5 var(--font);
  background: var(--bg);
}

.wrap {
  width: min(1280px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 11.5rem;
  gap: 1.25rem;
  align-items: start;
}

.page-aside {
  position: sticky;
  top: 1rem;
  padding: 0.75rem 0.7rem;
  background: #fff;
  border: 1px solid var(--line);
}

.aside-title {
  margin: 0 0 0.55rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.archive-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.archive-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.38rem 0.45rem;
  border-radius: 4px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  font-size: 12px;
}

.archive-item a:hover {
  background: var(--head);
}

.archive-item.is-active a {
  background: var(--accent);
  color: #fff;
}

.archive-date { font-variant-numeric: tabular-nums; }
.archive-count {
  color: inherit;
  opacity: 0.7;
  font-weight: 600;
}

.archive-empty {
  color: var(--muted);
  font-size: 12px;
  padding: 0.35rem 0.45rem;
}

header.site-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 2px solid var(--ink);
}

.title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand a {
  color: inherit;
  text-decoration: none;
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.intro {
  margin: 0;
  max-width: 36rem;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.meta {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  line-height: 1.45;
  flex-shrink: 0;
}

.actions {
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}

button, .btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 4px;
  padding: 0.28rem 0.6rem;
  font: 600 12px/1 var(--font);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

button:hover, .btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

button.primary, .btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.primary:hover, .btn.primary:hover {
  background: #0a4f44;
  border-color: #0a4f44;
  color: #fff;
}

.summary {
  margin: 0 0 1.25rem;
  padding: 0.75rem 0.9rem;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
}

h2 {
  margin: 1.4rem 0 0.5rem;
  font-size: 1rem;
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  margin-bottom: 0.25rem;
}

th, td {
  border: 1px solid var(--line);
  padding: 0.45rem 0.55rem;
  vertical-align: top;
  text-align: left;
}

th {
  background: var(--head);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

td { font-size: 13px; }

.num { text-align: center; width: 2.5rem; white-space: nowrap; }
.score { text-align: center; font-weight: 700; color: var(--warn); width: 3.2rem; }
.mono { font-family: Consolas, "Courier New", monospace; font-size: 12px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.wrap-cell { word-break: break-word; }

a.ctx-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}

a.ctx-link:hover { color: #0a4f44; }

ul.compact {
  margin: 0;
  padding-left: 1.05rem;
}

ul.compact li { margin: 0.1rem 0; }

footer.site-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 900px) {
  .page-layout {
    grid-template-columns: 1fr;
  }
  .page-aside {
    position: static;
    order: -1;
  }
  .archive-list {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (max-width: 720px) {
  header.site-header { flex-direction: column; align-items: flex-start; }
  .meta { text-align: left; }
  .actions { justify-content: flex-start; }
  .hide-sm { display: none; }
}

@media print {
  body { background: #fff; }
  .wrap { width: 100%; margin: 0; padding: 0; }
  .no-print, .actions, .toast { display: none !important; }
  header.site-header { border-bottom-color: #000; }
  a.ctx-link {
    color: #000;
    text-decoration: none;
    word-break: break-all;
  }
  a.ctx-link::after {
    content: " (" attr(href) ")";
    font-size: 11px;
    color: #444;
  }
  tr { break-inside: avoid; }
  .hide-sm { display: table-cell !important; }
}
