:root {
  --bg: #14161a;
  --panel: #1e2128;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --accent: #e10600;
  --badge: #2c3140;
  --badge-strong: #0f5132;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

header {
  text-align: center;
  padding: 2rem 1rem 0.5rem;
}

h1 { margin: 0 0 0.25rem; font-size: 1.8rem; }
.tagline { color: var(--muted); margin: 0; }

#search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  justify-content: center;
  background: var(--panel);
  margin: 1.5rem auto;
  padding: 1.25rem;
  border-radius: 12px;
  max-width: 1100px;
}

.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field > label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

select, input[type="date"] {
  background: var(--bg);
  color: var(--text);
  border: 1px solid #3a3f4b;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font-size: 1rem;
  min-width: 10rem;
}
select:disabled { opacity: 0.6; }

.toggle { display: flex; border: 1px solid #3a3f4b; border-radius: 8px; overflow: hidden; }
.toggle input { display: none; }
.toggle label {
  padding: 0.55rem 1rem;
  cursor: pointer;
  font-size: 1rem;
  color: var(--muted);
  background: var(--bg);
}
.toggle input:checked + label { background: var(--accent); color: #fff; }

#search-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1.8rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
#search-btn:disabled { opacity: 0.5; cursor: wait; }

#status {
  text-align: center;
  color: var(--muted);
  padding: 1rem;
  font-size: 1.05rem;
}
#status.error { color: #ff6b6b; }

#results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

.card {
  background: var(--panel);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  transition: transform 0.12s ease;
}
.card:hover { transform: translateY(-3px); }

.card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #000;
}

.card .info { padding: 0.75rem 0.9rem 0.9rem; display: flex; flex-direction: column; gap: 0.4rem; }
.card .title { font-weight: 600; line-height: 1.3; }
.card .meta { color: var(--muted); font-size: 0.85rem; }

.event-date { font-size: 0.85rem; }
.event-date.stated { color: #7bd88f; }
.event-date.assumed { color: var(--muted); font-style: italic; }
.event-date.differs { color: #ff8a80; }

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  border-top: 1px solid #3a3f4b;
  padding-top: 0.55rem;
  margin-top: 0.15rem;
}
.badges:empty { display: none; }

.card.low-score { background: #371b1b; }
.card.low-score .badges { border-top-color: #5a3030; }
.badge {
  background: var(--badge);
  color: var(--text);
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}
.badge.date-match { background: var(--badge-strong); }
.badge.negative { background: #5c2b29; }
