:root { --bg: #0e1020; --ink: #f4f1ff; --mut: #aeabd0; --card: #1b1e3a; --acc: #ffd24a; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  font-family: ui-rounded, 'Trebuchet MS', 'Segoe UI', sans-serif;
  background:
    radial-gradient(1100px 560px at 15% -10%, #2c2678 0, transparent 60%),
    radial-gradient(900px 520px at 100% 0, #5a1f5e 0, transparent 55%),
    var(--bg);
  background-attachment: fixed;
}
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 clamp(14px, 3.5vw, 44px); }

/* ---------- header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding-top: 18px; }
.logo { font-size: clamp(21px, 3vw, 26px); font-weight: 900; letter-spacing: -.02em; }
.logo span { color: var(--acc); }
.tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.tools button {
  font: inherit; font-size: 14px; font-weight: 700; color: var(--ink); cursor: pointer;
  background: rgba(255,255,255,.1); border: 0; border-radius: 999px; height: 38px; padding: 0 16px; white-space: nowrap;
}
.tools button:hover { background: rgba(255,255,255,.18); }
.tools button:focus-visible, .search input:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.search { display: flex; align-items: center; background: rgba(255,255,255,.1); border-radius: 999px; }
.search button { background: none; width: 38px; padding: 0; display: grid; place-items: center; }
.search button:hover { background: rgba(255,255,255,.12); }
.search svg { width: 18px; height: 18px; display: block; }
.search input {
  font: inherit; font-size: 15px; color: var(--ink); background: none; border: 0; border-radius: 999px;
  width: 0; height: 38px; padding: 0; opacity: 0; transition: width .22s ease, opacity .22s ease, padding .22s ease;
}
.search input::placeholder { color: var(--mut); }
.search input::-webkit-search-cancel-button { display: none; }
.search.open input { width: min(230px, 44vw); padding: 0 14px 0 2px; opacity: 1; }

/* ---------- hero ---------- */
.hero { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 24px; padding: clamp(18px, 3.4vw, 34px) 0 clamp(12px, 2vw, 18px); }
.hero h1 { margin: 0; font-size: clamp(26px, 4vw, 42px); line-height: 1.05; letter-spacing: -.03em; font-weight: 900; }
.hero h1 em { font-style: normal; color: var(--acc); }
.hero p { margin: 0; color: var(--mut); font-size: 15px; }

/* ---------- tiles ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(46%, 190px), 1fr)); gap: 16px; padding: 6px 0 170px; }
.card {
  position: relative; display: block; border-radius: 14px; background: var(--card); color: inherit; text-decoration: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.32);
  transform: perspective(800px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px)) scale(var(--s, 1));
  transition: transform .16s ease, box-shadow .16s ease;
  animation: pop .45s cubic-bezier(.2, .9, .3, 1.2) both; animation-delay: calc(var(--i) * 45ms);
}
@keyframes pop { from { opacity: 0; transform: translateY(20px) scale(.95); } }
.card:hover, .card:focus-visible { --lift: -5px; --s: 1.04; z-index: 5; outline: none; box-shadow: 0 18px 36px rgba(0,0,0,.55); }
.card:focus-visible .stage { box-shadow: inset 0 0 0 3px var(--acc); }
.stage { position: relative; aspect-ratio: 16 / 11; overflow: hidden; border-radius: 14px 14px 0 0; background: var(--c2); }
.stage canvas { display: block; width: 100%; height: 100%; }
.stage::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inherit; pointer-events: none; }
.best {
  position: absolute; left: 8px; top: 8px; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px;
  background: rgba(10,10,26,.72); color: #fff;
}
.go {
  position: absolute; right: 8px; bottom: 8px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--c1); color: #10121f; font-size: 13px; opacity: 0; transform: scale(.6); transition: opacity .16s ease, transform .16s ease;
}
.card:hover .go, .card:focus-visible .go { opacity: 1; transform: none; }
.body { padding: 10px 12px 12px; border-bottom: 3px solid transparent; border-radius: 0 0 14px 14px; }
.body h2 { margin: 0 0 2px; font-size: 16px; font-weight: 900; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.body .tag { margin: 0; color: var(--mut); font-size: 12.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }

/* details drop down below the tile on hover, over the row beneath, so the preview stays visible */
.more {
  position: absolute; left: 0; right: 0; top: calc(100% - 12px); padding: 6px 12px 12px;
  background: var(--card); border-radius: 0 0 14px 14px; border-bottom: 3px solid var(--c1);
  box-shadow: 0 18px 30px rgba(0,0,0,.55); font-size: 12.5px; line-height: 1.42;
  opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity .16s ease, transform .16s ease, visibility .16s;
}
.card:hover .more, .card:focus-visible .more { opacity: 1; visibility: visible; transform: none; }
.more p { margin: 0 0 7px; }
.more .ctl { color: var(--acc); font-weight: 700; }
.meta { display: flex; flex-wrap: wrap; gap: 5px; }
.meta span { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.09); color: var(--mut); }

.empty { color: var(--mut); font-size: 16px; padding: 30px 0 60px; margin-top: -150px; }
footer { color: var(--mut); font-size: 13px; padding: 0 0 30px; display: flex; flex-wrap: wrap; gap: 6px 18px; }
footer a { color: var(--mut); }
footer a:hover { color: var(--ink); }

/* Ad banner under the grid. Hidden until an ad unit is configured in assets/config.js. */
.ad { text-align: center; margin: -110px 0 40px; min-height: 120px; }
.ad::before {
  content: 'Advertisement'; display: block; margin-bottom: 6px;
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: #77759a;
}

/* ---------- text pages (privacy) ---------- */
.prose { max-width: 70ch; padding: 10px 0 60px; line-height: 1.6; color: #dcd9f2; }
.prose h1 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -.02em; margin: 18px 0 6px; color: var(--ink); }
.prose h2 { font-size: 19px; margin: 30px 0 6px; color: var(--ink); }
.prose a { color: var(--acc); }
.prose .note { color: var(--mut); font-size: 14px; }
.logo a { color: inherit; text-decoration: none; }

@media (hover: none) {
  .more { display: none; }
  .go { opacity: 1; transform: none; }
  .grid { padding-bottom: 60px; }
  .empty { margin-top: -40px; }
}
@media (prefers-reduced-motion: reduce) {
  .card { animation: none; transition: none; transform: none; }
  .more, .go, .search input { transition: none; }
}
