:root {
  --bg: #f7f4ec;
  --surface: #fffdf8;
  --text: #2a2620;
  --text-muted: #766f5e;
  --border: #ddd5bf;
  --accent: #7a2e2e;
  --accent-hover: #5e2323;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1815;
    --surface: #221f1a;
    --text: #e9e3d3;
    --text-muted: #a39a83;
    --border: #3a362c;
    --accent: #d08a8a;
    --accent-hover: #e0a3a3;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

h1, h2 {
  font-family: Georgia, Cambria, "Times New Roman", serif;
  font-weight: 600;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px 56px;
}

header.site-header {
  padding: 40px 0 8px;
}

header.site-header h1 {
  margin: 0 0 10px;
  font-size: 1.9rem;
}

header.site-header p {
  margin: 0 0 28px;
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 56ch;
}

.back-link {
  display: inline-block;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin: 24px 0 4px;
  border-bottom: 1px solid transparent;
}

.back-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.subject-list {
  border-top: 1px solid var(--border);
}

.subject-card {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 18px 4px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.subject-card:hover .subject-title {
  color: var(--accent);
}

.subject-card .icon {
  flex-shrink: 0;
  font-family: Georgia, serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 3px 6px;
  align-self: flex-start;
  margin-top: 4px;
}

.subject-card .subject-body {
  flex-grow: 1;
  min-width: 0;
}

.subject-card .subject-title {
  font-family: Georgia, Cambria, "Times New Roman", serif;
  font-size: 1.15rem;
  font-weight: 600;
}

.subject-card p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.subject-card .count {
  flex-shrink: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  align-self: center;
}

.pdf-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--border);
}

.pdf-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--border);
}

.pdf-item .doc-icon {
  flex-shrink: 0;
  font-family: Georgia, serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 5px;
}

.pdf-item .pdf-title {
  flex-grow: 1;
  min-width: 0;
}

.pdf-item a.open-btn {
  flex-shrink: 0;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: 0.9rem;
}

.pdf-item a.open-btn:hover {
  color: var(--accent-hover);
}

.empty-state {
  color: var(--text-muted);
  padding: 24px 2px;
  font-size: 0.95rem;
  border-top: 1px solid var(--border);
}

footer.site-footer {
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 36px 0 0;
}
