:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --border: #e4e4e0;
  --text: #1a1a18;
  --text-muted: #6b6b66;
  --accent: #b5651d;
  --accent-contrast: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161614;
    --surface: #201f1c;
    --border: #34332e;
    --text: #ece9e4;
    --text-muted: #9c988f;
    --accent: #e0a35c;
    --accent-contrast: #1a1a18;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
}

.page-header {
  padding: 2rem 1.25rem 1rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  text-align: center;
}

.page-header h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.6rem, 4vw, 2.25rem);
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
  width: 100%;
  flex: 1;
}

.search-bar {
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 0.75rem 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#search {
  width: 100%;
  font-size: 1.05rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
}

#search:focus {
  border-color: var(--accent);
}

.count {
  color: var(--text-muted);
  font-size: 0.85rem;
  min-height: 1.1em;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.75rem 1rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
}

.item-name {
  font-weight: 600;
  font-size: 1.02rem;
  grid-column: 2;
}

.item-date {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  grid-column: 1;
}

.item-links {
  grid-column: 3;
  display: flex;
  gap: 0.75rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

.item-links a {
  text-decoration: none;
}

.item-links a:hover {
  text-decoration: underline;
}

@media (max-width: 560px) {
  .item-card {
    grid-template-columns: 1fr auto;
  }
  .item-date {
    grid-column: 1;
  }
  .item-name {
    grid-column: 1 / -1;
  }
  .item-links {
    grid-column: 1 / -1;
  }
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2.5rem 1rem;
}

.load-more {
  display: block;
  margin: 1.25rem auto 0;
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
}

.load-more:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.page-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 1.5rem 1.25rem 2.5rem;
}

mark {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}
