* { box-sizing: border-box; }
:root {
  --ink: #2a2340;
  --muted: #6b6187;
  --card: rgba(255,255,255,.78);
  --line: rgba(120,100,180,.18);
  --pink: #ff9ecb;
  --lav: #b9a6ff;
  --mint: #9ff0d8;
}
html { color-scheme: light; }
body {
  margin: 0;
  font-family: Nunito, system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 600px at 12% -10%, #ffe3f3 0%, transparent 60%),
    radial-gradient(900px 620px at 88% 8%, #e3ddff 0%, transparent 62%),
    radial-gradient(900px 700px at 50% 110%, #d9fff2 0%, transparent 60%),
    linear-gradient(180deg, #fdf7ff 0%, #f4f6ff 55%, #effcf8 100%);
  min-height: 100vh;
}
.glow {
  position: fixed; inset: -20% -10% auto; height: 60vh; pointer-events: none; z-index: 0;
  background: radial-gradient(50% 60% at 50% 40%, rgba(255,255,255,.9), transparent 70%);
}
.hero { position: relative; z-index: 1; text-align: center; padding: 4.2rem 1.25rem 1.5rem; }
.avatar {
  width: 84px; height: 84px; border-radius: 24px; object-fit: cover;
  border: 3px solid #fff; box-shadow: 0 10px 30px rgba(120,90,180,.25); rotate: -3deg;
  background: #eee;
}
.kicker { margin: .9rem 0 .2rem; font-size: .78rem; letter-spacing: .22em; text-transform: uppercase; color: #a06ab8; font-weight: 800; }
h1 {
  font-family: "Baloo 2", Nunito, sans-serif; font-weight: 800;
  font-size: clamp(2.4rem, 7vw, 4.4rem); letter-spacing: -.03em; margin: 0;
  background: linear-gradient(100deg, #ff8fc4 0%, #b48cff 45%, #63d9bd 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(255,255,255,.8));
}
.sub { margin: .4rem auto 1rem; max-width: 34rem; color: var(--muted); font-size: 1.02rem; }
.steam {
  display: inline-block; font-size: .86rem; font-weight: 800; text-decoration: none;
  color: #5a3c7a; background: var(--card); border: 1px solid var(--line);
  padding: .5rem .9rem; border-radius: 999px; box-shadow: 0 6px 18px rgba(120,90,180,.12);
}
.steam:hover { background: #fff; transform: translateY(-1px); }

.stats {
  position: relative; z-index: 1; display: grid; gap: .8rem; margin: 1.6rem auto 0; padding: 0 1.25rem;
  max-width: 76rem; grid-template-columns: repeat(4, minmax(0,1fr));
}
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: 1rem 1.1rem; text-align: center; backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(130,100,190,.10);
}
.stat strong { display: block; font-family: "Baloo 2", sans-serif; font-size: clamp(1.25rem, 2.4vw, 1.85rem); line-height: 1.15; }
.stat span { font-size: .78rem; color: var(--muted); font-weight: 700; }

.shelf { position: relative; z-index: 1; max-width: 76rem; margin: 2.4rem auto 0; padding: 0 1.25rem; }
.controls h2 { font-family: "Baloo 2", sans-serif; font-size: 1.9rem; margin: 0 0 .6rem; }
.control-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.search input {
  width: min(22rem, 78vw); padding: .62rem .95rem; border-radius: 999px; font: inherit;
  border: 1px solid var(--line); background: rgba(255,255,255,.85); color: var(--ink);
  box-shadow: inset 0 1px 2px rgba(90,60,140,.06);
}
.search input:focus { outline: 3px solid rgba(185,166,255,.45); outline-offset: 1px; }
.sort { display: flex; gap: .35rem; background: rgba(255,255,255,.6); border: 1px solid var(--line); border-radius: 999px; padding: .25rem; }
.sort button {
  font: inherit; font-size: .82rem; font-weight: 800; color: var(--muted);
  border: 0; background: transparent; padding: .4rem .8rem; border-radius: 999px; cursor: pointer;
}
.sort button.on { background: #fff; color: #4b2f6b; box-shadow: 0 3px 10px rgba(120,90,180,.18); }
.count { margin: .6rem 0 1rem; font-size: .82rem; font-weight: 700; color: var(--muted); }

.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  backdrop-filter: blur(8px); box-shadow: 0 10px 26px rgba(130,100,190,.10);
  transition: transform .18s ease, box-shadow .18s ease; margin: 0;
}
.card:hover { transform: translateY(-4px) rotate(-.4deg); box-shadow: 0 18px 36px rgba(130,100,190,.20); }
.art { position: relative; aspect-ratio: 460/215; background: linear-gradient(135deg, #ffd9ec, #dcd6ff 50%, #c9f7e8); display: grid; place-items: center; }
.art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art .initial { font-family: "Baloo 2", sans-serif; font-size: 3rem; color: rgba(90,60,140,.35); display: none; }
.art.noart .initial { display: block; }
.crown { position: absolute; top: 6px; left: 8px; font-size: 1.35rem; filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); }
.meta { padding: .7rem .85rem .85rem; display: flex; flex-direction: column; gap: .35rem; }
.meta h3 { margin: 0; font-size: .98rem; line-height: 1.25; }
.pill {
  align-self: flex-start; font-size: .72rem; font-weight: 800; color: #6a3f8f;
  background: linear-gradient(180deg, #f6efff, #efe6ff); border: 1px solid rgba(150,110,200,.25);
  padding: .12rem .5rem; border-radius: 999px;
}
.empty { text-align: center; color: var(--muted); padding: 2rem 0; }
footer { position: relative; z-index: 1; max-width: 76rem; margin: 3rem auto 0; padding: 2rem 1.25rem 3rem; text-align: center; color: var(--muted); font-size: .84rem; }
footer p { margin: .25rem 0; }
.tiny { font-size: .76rem; opacity: .75; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hero { padding-top: 3rem; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .steam { transition: none; }
  .card:hover { transform: none; }
}

.back {
  position: fixed; top: 14px; left: 14px; z-index: 5; text-decoration: none;
  font-size: .8rem; font-weight: 800; color: #5a3c7a; background: rgba(255,255,255,.8);
  border: 1px solid var(--line); padding: .38rem .7rem; border-radius: 999px;
  box-shadow: 0 6px 18px rgba(120,90,180,.14); backdrop-filter: blur(8px);
}
.back:hover { background: #fff; }
