:root {
  --bg: #fff8ee;
  --bg-2: #fff1dc;
  --surface: #ffffff;
  --ink: #1d1a2b;
  --muted: #6b6578;
  --line: #eadfce;
  --accent: #ff5a36;
  --accent-2: #ffb800;
  --accent-ink: #ffffff;
  --shadow: 0 1px 0 rgba(29, 26, 43, .06), 0 8px 24px -12px rgba(29, 26, 43, .25);
  --shadow-lg: 0 2px 0 rgba(29, 26, 43, .08), 0 24px 48px -20px rgba(29, 26, 43, .35);
  --thumb-mix: 100%;
  --radius: 20px;
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15131f; --bg-2: #1c1929; --surface: #221f31; --ink: #f4f0ff; --muted: #a39db3;
    --line: #34304a; --accent: #ff6a48; --accent-2: #ffc533;
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6);
    --shadow-lg: 0 2px 0 rgba(0,0,0,.3), 0 24px 48px -20px rgba(0,0,0,.7);
    --thumb-mix: 38%;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15131f; --bg-2: #1c1929; --surface: #221f31; --ink: #f4f0ff; --muted: #a39db3;
  --line: #34304a; --accent: #ff6a48; --accent-2: #ffc533;
  --shadow: 0 1px 0 rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-lg: 0 2px 0 rgba(0,0,0,.3), 0 24px 48px -20px rgba(0,0,0,.7);
  --thumb-mix: 38%;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 var(--font-body); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.05; margin: 0; letter-spacing: -.02em; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; border-radius: 8px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: .45em; justify-content: center;
  padding: .8em 1.3em; border-radius: 999px; border: 2px solid transparent;
  font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .15s ease, box-shadow .15s ease, background .15s;
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 0 color-mix(in oklab, var(--accent) 70%, #000); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 0 color-mix(in oklab, var(--accent) 70%, #000); }
.btn-ghost { background: var(--surface); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-sm { padding: .5em .9em; font-size: .9rem; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in oklab, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: .6rem; text-decoration: none; font: 800 1.25rem var(--font-display); letter-spacing: -.02em; }
.logo b { color: var(--accent); font-weight: 800; }
.logo-die {
  width: 34px; height: 34px; border-radius: 9px; background: var(--accent); position: relative;
  display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 6px; transform: rotate(-8deg);
  box-shadow: 0 3px 0 color-mix(in oklab, var(--accent) 65%, #000);
}
.logo-die i { width: 5px; height: 5px; border-radius: 50%; background: #fff; place-self: center; }
.logo-die i:nth-child(1) { grid-area: 1/1; } .logo-die i:nth-child(2) { grid-area: 1/3; }
.logo-die i:nth-child(3) { grid-area: 2/2; } .logo-die i:nth-child(4) { grid-area: 3/1; }
.logo-die i:nth-child(5) { grid-area: 3/3; }
.logo:hover .logo-die { animation: roll .6s ease; }
@keyframes roll { 50% { transform: rotate(180deg) scale(.9); } 100% { transform: rotate(352deg); } }

/* Hero */
.hero {
  background:
    radial-gradient(600px 300px at 85% 10%, color-mix(in oklab, var(--accent-2) 30%, transparent), transparent 70%),
    radial-gradient(500px 300px at 0% 100%, color-mix(in oklab, var(--accent) 18%, transparent), transparent 70%),
    var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.hero-in { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: center; padding: 72px 0 80px; }
.eyebrow { display: inline-flex; align-items: center; gap: .5rem; margin: 0 0 1.2rem; padding: .35em .9em; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 700; font-size: .9rem; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #2ecc71; box-shadow: 0 0 0 0 rgba(46,204,113,.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(46,204,113,0); } 100% { box-shadow: 0 0 0 0 rgba(46,204,113,0); } }
.hero h1 { font-size: clamp(2.6rem, 6.5vw, 5rem); font-weight: 800; }
.hl { color: var(--accent); position: relative; white-space: nowrap; }
.hl::after { content: ""; position: absolute; left: 0; right: 0; bottom: .02em; height: .14em; background: var(--accent-2); border-radius: 4px; z-index: -1; opacity: .7; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 34em; margin: 1.3rem 0 2rem; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* Featured (newest) card */
.featured {
  --c: #ffe08a;
  display: block; text-decoration: none; border-radius: 28px; overflow: hidden; background: var(--surface);
  box-shadow: var(--shadow-lg); border: 1px solid var(--line); transform: rotate(1.5deg);
  transition: transform .25s ease;
}
.featured:hover { transform: rotate(0) translateY(-4px); }
.featured .thumb { aspect-ratio: 16/10; font-size: clamp(5rem, 12vw, 8rem); }
.featured-body { padding: 20px 24px 24px; }
.featured-kicker { font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.featured h3 { font-size: 1.8rem; margin: .3rem 0 .4rem; }
.featured p { margin: 0 0 .9rem; color: var(--muted); }

/* Catalog */
.catalog { padding: 64px 0 40px; }
.catalog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.catalog-head h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.search { display: flex; align-items: center; gap: .5rem; background: var(--surface); border: 2px solid var(--line); border-radius: 999px; padding: .55em 1em; min-width: min(320px, 100%); }
.search:focus-within { border-color: var(--ink); }
.search input { border: 0; outline: 0; background: transparent; width: 100%; }
.filters { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; margin-bottom: 28px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip-label { font-weight: 700; color: var(--muted); font-size: .9rem; margin-right: 2px; }
.chip { border: 1.5px solid var(--line); background: var(--surface); padding: .35em .9em; border-radius: 999px; cursor: pointer; font-weight: 500; font-size: .92rem; transition: all .15s; }
.chip:hover { border-color: var(--ink); }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.sort { margin-left: auto; display: flex; align-items: center; gap: .5rem; font-size: .92rem; color: var(--muted); font-weight: 700; }
.sort select { background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; padding: .35em .6em; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }
.card {
  --c: #ffe08a;
  position: relative; display: flex; flex-direction: column; text-decoration: none; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
  animation: pop .35s ease both;
}
.card:hover { transform: translateY(-5px) rotate(-.6deg); box-shadow: var(--shadow-lg); }
.card:nth-child(even):hover { transform: translateY(-5px) rotate(.6deg); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.thumb {
  display: grid; place-items: center; aspect-ratio: 4/3; font-size: 4.2rem; line-height: 1;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.45), transparent 55%),
    color-mix(in oklab, var(--c) var(--thumb-mix), var(--surface));
  position: relative; overflow: hidden;
}
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb .em { filter: drop-shadow(0 6px 8px rgba(0,0,0,.18)); transition: transform .3s ease; }
.card:hover .thumb .em { transform: scale(1.12) rotate(-6deg); }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: .45rem; flex: 1; }
.card h3 { font-size: 1.3rem; }
.card p { margin: 0; color: var(--muted); font-size: .94rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: .4rem; }
.tag { font-size: .8rem; font-weight: 700; padding: .2em .65em; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); color: var(--ink); }
.badge-new {
  display: inline-block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  background: var(--accent-2); color: #1d1a2b; padding: .25em .7em; border-radius: 999px;
}
.card .badge-new { position: absolute; top: 12px; left: 12px; z-index: 1; transform: rotate(-4deg); box-shadow: 0 2px 0 rgba(0,0,0,.15); }

.empty { text-align: center; padding: 64px 16px; color: var(--muted); border: 2px dashed var(--line); border-radius: var(--radius); }
.empty .big { font-size: 3rem; display: block; margin-bottom: .5rem; }
.empty strong { color: var(--ink); font-family: var(--font-display); font-size: 1.4rem; display: block; margin-bottom: .3rem; }

.skeleton { border-radius: var(--radius); background: linear-gradient(90deg, var(--bg-2), var(--surface), var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; aspect-ratio: 4/4.4; border: 1px solid var(--line); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* How it works */
.how { padding: 40px 0 72px; }
.how-in { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.how-in > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.how-n { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--ink); color: var(--bg); font: 800 1.1rem var(--font-display); margin-bottom: 12px; }
.how h3 { font-size: 1.25rem; margin-bottom: .3rem; }
.how p { margin: 0; color: var(--muted); }

.footer { border-top: 1px solid var(--line); padding: 24px 0; color: var(--muted); font-size: .9rem; }
.footer-in { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Play page */
body.play { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.playbar { display: flex; align-items: center; gap: 12px; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); background: var(--bg); }
.playbar-title { flex: 1; min-width: 0; text-align: center; font: 800 1.15rem var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.playbar-actions { display: flex; gap: 8px; }
.stage { flex: 1; position: relative; background: var(--surface); }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.stage-msg { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 1rem; padding: 24px; background: var(--bg); }
.stage-msg .big { font-size: 4rem; }
.stage-msg h2 { font-size: 2rem; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: .7em 1.2em; border-radius: 999px; font-weight: 700; box-shadow: var(--shadow-lg); z-index: 50; }

/* 404 */
.notfound { min-height: 100vh; display: grid; place-content: center; text-align: center; gap: 1rem; padding: 24px; }
.notfound-die { font-size: 5rem; animation: roll 1.2s ease infinite alternate; }
.notfound h1 { font-size: clamp(2.4rem, 7vw, 4rem); }
.notfound p { color: var(--muted); margin: 0 0 .5rem; }

/* Responsive */
@media (max-width: 860px) {
  .hero-in { grid-template-columns: 1fr; padding: 48px 0 56px; gap: 36px; }
  .featured { transform: none; max-width: 520px; }
  .how-in { grid-template-columns: 1fr; }
  .sort { margin-left: 0; }
}
@media (max-width: 560px) {
  .hide-sm { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
  .card-body { padding: 12px 14px 14px; }
  .card h3 { font-size: 1.1rem; }
  .thumb { font-size: 3.2rem; }
  .catalog { padding-top: 44px; }
  .playbar { padding-inline: 10px; gap: 8px; }
  .hero-in { padding: 36px 0 44px; }
  .lead { font-size: 1.05rem; }
  .hero-cta .btn { flex: 1; }
  .featured .thumb { aspect-ratio: 16/7; font-size: 4.5rem; }
  .featured-body { padding: 16px 18px 18px; }
  .featured h3 { font-size: 1.5rem; }
  .search { width: 100%; }
  .filters { gap: 10px; }
  .chip-row { flex-wrap: nowrap; overflow-x: auto; width: calc(100% + 32px); margin-inline: -16px; padding: 2px 16px; scrollbar-width: none; }
  .chip-row::-webkit-scrollbar { display: none; }
  .chip, .chip-label { flex: none; }
  .chip { padding: .45em 1em; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
