:root {
  --bg: #10141c;
  --bg-elev: #181e2a;
  --card: #1e2636;
  --line: #2d3850;
  --text: #f4f6fb;
  --muted: #9aa6bf;
  --red: #e60012;
  --red-dark: #b4000e;
  --owned: #2bd576;
  --owned-bg: rgba(43, 213, 118, 0.12);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(230, 0, 18, 0.18), transparent 55%),
    var(--bg);
  color: var(--text);
  padding: 24px 20px 64px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  max-width: 1280px;
  margin: 0 auto 20px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.mark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.18);
}

h1 {
  margin: 0;
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}

.tagline,
.meta,
.empty,
.status {
  color: var(--muted);
  margin: 4px 0 0;
}

.stats {
  font-variant-numeric: tabular-nums;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  white-space: nowrap;
}

.toolbar {
  max-width: 1280px;
  margin: 0 auto 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.search {
  flex: 1 1 260px;
}

select {
  flex: 0 1 170px;
}

.search input,
select,
.btn {
  width: 100%;
}

input,
select,
.btn {
  font: inherit;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}

.btn {
  cursor: pointer;
  width: auto;
}

.btn:hover {
  border-color: #4a5878;
}

.btn-primary {
  background: var(--red);
  border-color: var(--red);
}

.btn-primary:hover {
  background: var(--red-dark);
}

.btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.actions {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status,
.meta,
.empty {
  max-width: 1280px;
  margin: 0 auto 14px;
}

.status[data-kind="error"] {
  color: #ff8a8a;
}

.status[data-kind="ok"] {
  color: var(--owned);
}

.grid {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr));
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  color: inherit;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  min-width: 0;
  width: 100%;
}

.card:hover,
.card:focus-visible {
  outline: none;
  border-color: #5b6d94;
  transform: translateY(-2px);
}

.card.owned {
  border-color: rgba(43, 213, 118, 0.55);
  background: linear-gradient(180deg, var(--owned-bg), var(--card) 42%);
}

.thumb {
  background: #fff;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 100%;
  min-width: 0;
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.thumb-missing {
  background: #e8ebf2;
}

.thumb-missing::after {
  content: "image missing";
  color: #6b7691;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.name {
  font-weight: 700;
  line-height: 1.25;
}

.series {
  color: var(--muted);
  font-size: 0.82rem;
}

.facts {
  color: var(--muted);
  font-size: 0.74rem;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}

.date {
  font-size: 0.78rem;
  color: var(--muted);
}

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: #2a3348;
  color: var(--muted);
}

.card.owned .badge {
  background: var(--owned);
  color: #052012;
}

@media (max-width: 860px) {
  body {
    padding: 16px 12px 48px;
  }

  .top {
    flex-direction: column;
    align-items: flex-start;
  }

  select {
    flex: 1 1 140px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 148px), 1fr));
    gap: 10px;
  }
}
