:root {
  --bg: #fff6ec;
  --surface: #ffffff;
  --text: #2a2140;
  --muted: #6e6585;
  --line: #f0e4d6;
  --field: #ffffff;
  --shadow: 0 2px 0 rgb(42 33 64 / .06), 0 14px 34px -10px rgb(122 72 40 / .25);
  --shadow-hover: 0 2px 0 rgb(42 33 64 / .06), 0 26px 50px -14px rgb(122 72 40 / .4);
  --blob1: #ffd6a5; --blob2: #caffbf; --blob3: #bde0fe;
  --t0: #ffe1e1; --t0t: #b3261e;
  --t1: #fff0c2; --t1t: #8a5a00;
  --t2: #d3f5f1; --t2t: #0d6b62;
  --t3: #dde9ff; --t3t: #1f55b8;
  --t4: #ece0ff; --t4t: #6232a8;
  --t5: #ffe0f2; --t5t: #a4246f;
  --r-lg: 32px; --r-md: 22px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1433; --surface: #261e47; --text: #f6f1ff; --muted: #b9afd6; --line: #3a3062; --field: #2d2453;
    --shadow: 0 2px 0 rgb(0 0 0 / .2), 0 16px 36px -12px rgb(0 0 0 / .6);
    --shadow-hover: 0 2px 0 rgb(0 0 0 / .2), 0 28px 56px -14px rgb(0 0 0 / .75);
    --blob1: #6d2e6f; --blob2: #1f5c63; --blob3: #3a3a8c;
    --t0: #4a2333; --t0t: #ffb3b3; --t1: #4a3a17; --t1t: #ffd97a; --t2: #173f42; --t2t: #8ef0e4;
    --t3: #22325e; --t3t: #a9c8ff; --t4: #3a2862; --t4t: #d3b8ff; --t5: #4a2142; --t5t: #ffb0dc;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1433; --surface: #261e47; --text: #f6f1ff; --muted: #b9afd6; --line: #3a3062; --field: #2d2453;
  --shadow: 0 2px 0 rgb(0 0 0 / .2), 0 16px 36px -12px rgb(0 0 0 / .6);
  --shadow-hover: 0 2px 0 rgb(0 0 0 / .2), 0 28px 56px -14px rgb(0 0 0 / .75);
  --blob1: #6d2e6f; --blob2: #1f5c63; --blob3: #3a3a8c;
  --t0: #4a2333; --t0t: #ffb3b3; --t1: #4a3a17; --t1t: #ffd97a; --t2: #173f42; --t2t: #8ef0e4;
  --t3: #22325e; --t3t: #a9c8ff; --t4: #3a2862; --t4t: #d3b8ff; --t5: #4a2142; --t5t: #ffb0dc;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; } /* si no, display: flex de .card anula hidden y el filtro no oculta nada */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 500 1rem/1.55 "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
h1, h2, .brand, .chip, .pill, .badge { font-family: "Fredoka", "Nunito", system-ui, sans-serif; }
img { display: block; max-width: 100%; height: auto; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
a { color: inherit; }
:focus-visible { outline: 3px solid #ff6b6b; outline-offset: 3px; border-radius: 12px; }

.wrap { position: relative; width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -60px; background: #ff6b6b; color: #fff; padding: 10px 16px; border-radius: 999px; z-index: 20; font-weight: 700; }
.skip:focus { top: 10px; }

/* Manchas de color de fondo */
.blobs { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.blobs span { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .7; }
.b1 { width: 420px; height: 420px; background: var(--blob1); top: -140px; right: -120px; }
.b2 { width: 360px; height: 360px; background: var(--blob2); top: 38%; left: -180px; }
.b3 { width: 440px; height: 440px; background: var(--blob3); bottom: -200px; right: 10%; }

/* Cabecera: barra flotante en forma de píldora */
.top { position: sticky; top: 0; z-index: 10; padding-top: 12px; }
.bar {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; padding: 0 8px 0 10px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 1.375rem; letter-spacing: -.01em; }
.brand b { font-weight: 700; color: #ff6b6b; }
.brand__mark { width: 40px; height: 40px; stroke: none; transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.brand:hover .brand__mark { transform: rotate(-12deg) scale(1.06); }
.theme { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--t1); color: var(--t1t); cursor: pointer; transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.theme:hover { transform: rotate(20deg) scale(1.08); }
.theme svg { width: 22px; height: 22px; }
.theme .i-sun { display: none; }
:root[data-theme="dark"] .theme .i-sun { display: block; }
:root[data-theme="dark"] .theme .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme .i-moon { display: none; }
}

/* Portada */
.hero { position: relative; padding: 44px 0 28px; text-align: center; }
.pill {
  display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 6px 8px;
  margin: 0 0 18px; padding: 8px 16px; border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow); font-size: .9375rem; font-weight: 500;
}
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.d1 { background: #ff6b6b; } .d2 { background: #ffb703; margin-left: 4px; } .d3 { background: #2ec4b6; margin-left: 4px; }
.hero h1 {
  margin: 0 auto 12px; max-width: 14ch;
  font-size: clamp(2.4rem, 1.4rem + 5vw, 4.4rem); line-height: 1.02; font-weight: 700; letter-spacing: -.02em; text-wrap: balance;
}
.hl { position: relative; display: inline-block; color: #ff6b6b; }
.hl::after {
  content: ""; position: absolute; left: -4%; right: -4%; bottom: .06em; height: .32em; z-index: -1;
  background: #ffd166; border-radius: 999px; transform: rotate(-2deg);
}
:root[data-theme="dark"] .hl::after { background: #6b4fd8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hl::after { background: #6b4fd8; } }
.lead { margin: 0 auto; max-width: 34ch; color: var(--muted); font-size: 1.125rem; }
.deco { position: absolute; width: 34px; height: 34px; stroke-width: 2.5; animation: bob 6s ease-in-out infinite; }
.deco--star { top: 30px; left: 4%; color: #ffb703; fill: #ffb703; stroke: none; }
.deco--ring { top: 58%; right: 3%; color: #4d96ff; stroke-width: 3.5; animation-delay: -2s; }
.deco--wave { width: 60px; height: 16px; bottom: 6px; left: 8%; color: #f15bb5; stroke-width: 3; animation-delay: -4s; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-10px) rotate(12deg); } }

/* Buscador y filtros */
.tools { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 8px 0 28px; }
.search { position: relative; display: block; width: 100%; max-width: 460px; }
.search svg { position: absolute; left: 20px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 56px; padding: 0 20px 0 52px; border: 2px solid transparent; border-radius: 999px;
  background: var(--field); color: var(--text); font: inherit; font-size: 1.0625rem; box-shadow: var(--shadow);
  transition: border-color .2s;
}
.search input:focus { outline: none; border-color: #ff6b6b; }
.search input::placeholder { color: var(--muted); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; max-width: calc(100% + 32px); margin: 0 -16px; padding: 4px 16px 10px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 42px; padding: 0 18px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--surface); color: var(--text); font-size: 1rem; font-weight: 500; box-shadow: var(--shadow);
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1), background .2s, color .2s;
}
.chip:hover { transform: translateY(-2px); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.chip.t0[aria-pressed="true"] { background: #ff6b6b; color: #fff; }
.chip.t1[aria-pressed="true"] { background: #ffb703; color: #2a2140; }
.chip.t2[aria-pressed="true"] { background: #2ec4b6; color: #08302c; }
.chip.t3[aria-pressed="true"] { background: #4d96ff; color: #fff; }
.chip.t4[aria-pressed="true"] { background: #9b5de5; color: #fff; }
.chip.t5[aria-pressed="true"] { background: #f15bb5; color: #fff; }

/* Tarjetas */
/* Flex en vez de grid para centrar la última fila cuando hay pocos juegos */
.grid { --cols: 1; --gap: 22px; list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--gap); }
.card { width: calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols)); }
.card {
  position: relative; display: flex; flex-direction: column; padding: 10px;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow);
  transition: transform .4s cubic-bezier(.34, 1.56, .64, 1), box-shadow .3s ease;
}
.card::before { /* borde de color del juego */
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 3px; pointer-events: none;
  background: linear-gradient(140deg, var(--c), color-mix(in srgb, var(--c) 30%, transparent) 60%, transparent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: .9;
}
.card:not(.is-soon):hover { transform: translateY(-6px) rotate(-.6deg); box-shadow: var(--shadow-hover); }
.card:nth-child(even):not(.is-soon):hover { transform: translateY(-6px) rotate(.6deg); }
.card:focus-within { outline: 3px solid var(--c); outline-offset: 4px; }
.card__img { position: relative; aspect-ratio: 800 / 420; border-radius: var(--r-md); overflow: hidden; background: color-mix(in srgb, var(--c) 25%, var(--surface)); }
.card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:not(.is-soon):hover .card__img img { transform: scale(1.06); }
.is-soon .card__img img { filter: grayscale(.5) brightness(.85); }
.badge { position: absolute; top: 12px; left: 12px; padding: 6px 14px; border-radius: 999px; background: #ffb703; color: #2a2140; font-size: .875rem; font-weight: 600; box-shadow: 0 6px 16px -6px rgb(0 0 0 / .4); }
.card__body { display: flex; flex-direction: column; gap: 6px; padding: 16px 12px 10px; flex: 1; }
.card__title { margin: 0; font-size: 1.5rem; line-height: 1.15; font-weight: 600; letter-spacing: -.01em; }
.card__title a { text-decoration: none; }
.card__title a::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-lg); } /* toda la tarjeta es el enlace */
.card__title a:focus-visible { outline: none; }
.card__desc { margin: 0; color: var(--muted); font-size: 1rem; }
.card__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 12px; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.tags li { padding: 4px 12px; border-radius: 999px; font-size: .875rem; font-weight: 700; }
.t0 { --tb: var(--t0); --tt: var(--t0t); } .t1 { --tb: var(--t1); --tt: var(--t1t); } .t2 { --tb: var(--t2); --tt: var(--t2t); }
.t3 { --tb: var(--t3); --tt: var(--t3t); } .t4 { --tb: var(--t4); --tt: var(--t4t); } .t5 { --tb: var(--t5); --tt: var(--t5t); }
.tags li { background: var(--tb); color: var(--tt); }
.play {
  flex: none; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%;
  background: var(--c); color: #fff; box-shadow: 0 10px 22px -8px var(--c);
  transition: transform .4s cubic-bezier(.34, 1.56, .64, 1);
}
.play svg { width: 24px; height: 24px; fill: currentColor; stroke: none; margin-left: 3px; }
.card:hover .play { transform: scale(1.12) rotate(-8deg); }

.empty { color: var(--muted); text-align: center; padding: 40px 0; font-size: 1.125rem; }
.foot { margin-top: auto; padding: 56px 0 28px; text-align: center; color: var(--muted); font-size: .9375rem; }
.foot span { display: inline-block; padding: 8px 18px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); }

@media (min-width: 640px) {
  .grid { --cols: 2; --gap: 26px; }
  .chips { flex-wrap: wrap; justify-content: center; overflow: visible; margin: 0; padding: 4px; max-width: none; }
  .hero { padding: 72px 0 36px; }
  .deco { width: 46px; height: 46px; }
  .deco--wave { width: 80px; height: 22px; }
}
@media (min-width: 980px) {
  .grid { --cols: 3; --gap: 30px; }
  .deco--star { left: 10%; }
  .deco--ring { right: 10%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .card:not(.is-soon):hover, .card:nth-child(even):not(.is-soon):hover { transform: none; }
}
