:root {
  --bg: #0f1420;
  --card: #1a2130;
  --card-border: #2a3446;
  --text: #e6ebf2;
  --muted: #9aa7bd;
  --up: #4ade80;
  --down: #f87171;
  --accent: #60a5fa;
}

* { box-sizing: border-box; }

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

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

.filter {
  width: min(100%, 420px);
  padding: 0.6rem 0.9rem;
  font-size: 1rem;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 8px;
}

.filter:focus {
  outline: none;
  border-color: var(--accent);
}

.filter::placeholder {
  color: var(--muted);
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
}

.status {
  text-align: center;
  color: var(--muted);
  padding: 2rem 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

.card.wide {
  grid-column: span 2;
}

@media (max-width: 520px) {
  .card.wide {
    grid-column: auto;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card-img {
  width: 100%;
  height: auto;
  display: block;
  background: #0b0f18;
}

.card-body {
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-title {
  margin: 0;
  font-size: 1.1rem;
}

.badge {
  flex: none;
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: #14203a;
  border: 1px solid #24365c;
  border-radius: 6px;
  padding: 0.1rem 0.45rem;
  white-space: nowrap;
}

.card-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  flex: 1;
}

.vote-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--card-border);
}

.vote-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--card-border);
  background: #131a27;
  border-radius: 10px;
  cursor: pointer;
  filter: saturate(0.7) brightness(0.95);
  transition: transform 0.08s ease, background 0.15s ease,
    border-color 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.vote-icon {
  width: 1.6rem;
  height: 1.6rem;
  object-fit: contain;
  display: block;
}

.vote-btn:hover {
  background: #1d2637;
  transform: translateY(-2px);
  filter: none;
}

.vote-btn:active { transform: scale(0.9); }
.vote-btn:disabled { opacity: 0.5; cursor: default; }
.vote-btn.up:hover { border-color: var(--up); box-shadow: 0 0 14px -3px var(--up); }
.vote-btn.down:hover { border-color: var(--down); box-shadow: 0 0 14px -3px var(--down); }

.score {
  position: relative;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 2.25rem;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text);
  text-align: center;
  min-width: 3ch;
  cursor: default;
}

.score.positive { color: var(--up); }
.score.negative { color: var(--down); }

.score::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text);
  background: #0b1220;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.score:hover::after {
  opacity: 1;
}
