:root {
  --bg: #f4f1ec;
  --bg-elev: #ffffff;
  --fg: #2c2622;
  --fg-muted: #7a6f66;
  --accent: #e2001a;          /* Tonies red */
  --accent-soft: #fde7e9;
  --creative: #0a7d5a;
  --creative-soft: #e0f2eb;
  --border: #e7e0d7;
  --shadow: 0 1px 2px rgba(44, 38, 34, .06), 0 8px 24px rgba(44, 38, 34, .06);
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17140f;
    --bg-elev: #221e18;
    --fg: #f0ebe4;
    --fg-muted: #a89d90;
    --accent: #ff5a6a;
    --accent-soft: #3a1c20;
    --creative: #57d6ab;
    --creative-soft: #123128;
    --border: #322c24;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.wrap { width: min(1180px, 92vw); margin-inline: auto; }

/* Header */
.site-header {
  background: linear-gradient(180deg, var(--bg-elev), color-mix(in srgb, var(--bg-elev) 70%, var(--bg)));
  border-bottom: 1px solid var(--border);
  padding: clamp(1.5rem, 5vw, 3rem) 0 1.5rem;
}
h1 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  letter-spacing: -.02em;
}
.tagline { margin: .25rem 0 1.5rem; color: var(--fg-muted); font-size: 1.05rem; }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1rem;
  align-items: center;
}
.search {
  position: relative;
  flex: 1 1 260px;
  min-width: 200px;
}
.search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; fill: var(--fg-muted); pointer-events: none;
}
#search {
  width: 100%;
  padding: .7rem 1rem .7rem 2.6rem;
  font-size: 1rem;
  color: var(--fg);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
#search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.filters { display: flex; gap: .5rem; }
.chip {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--fg-muted);
  padding: .55rem 1.1rem;
  font-size: .95rem;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
}
.chip:hover { color: var(--fg); border-color: var(--fg-muted); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

.meta { margin: 1.25rem 0 0; color: var(--fg-muted); font-size: .95rem; min-height: 1.2em; }

/* Grid */
main { flex: 1; padding: 2rem 0 3rem; }
.grid {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  gap: clamp(1rem, 2.5vw, 1.75rem);
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 6px 12px rgba(44,38,34,.10), 0 18px 40px rgba(44,38,34,.14); }
.thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--accent-soft);
  display: grid; place-items: center;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; padding: 12%; }
.thumb img.broken { padding: 0; }
.badge {
  position: absolute; top: .6rem; left: .6rem;
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: .2rem .5rem; border-radius: 999px;
  background: var(--accent); color: #fff;
}
.badge.creative { background: var(--creative); }
.body { padding: .8rem 1rem 1.1rem; }
.title { margin: 0; font-size: 1rem; line-height: 1.3; }
.series { margin: .25rem 0 0; color: var(--fg-muted); font-size: .85rem; }

/* States */
.status, .empty { text-align: center; color: var(--fg-muted); padding: 3rem 1rem; font-size: 1.05rem; }
.status.error { color: var(--accent); }

.site-footer { border-top: 1px solid var(--border); padding: 1.25rem 0; color: var(--fg-muted); font-size: .85rem; }

@media (prefers-reduced-motion: reduce) {
  .card, #search { transition: none; }
  .card:hover { transform: none; }
}
