/* ============================================================
   ChallenThem · Theme · v2.0
   Diseño neón gaming, mobile-first, accesible
   ============================================================ */

:root {
  /* Paleta */
  --bg-0: #06080f;
  --bg-1: #0c1220;
  --bg-2: #131a2d;
  --surface: rgba(20, 28, 48, 0.72);
  --surface-hi: rgba(28, 38, 64, 0.88);
  --border: rgba(120, 140, 200, 0.18);
  --border-hi: rgba(160, 180, 240, 0.32);

  --ink: #eaf2ff;
  --ink-soft: #b8c4d8;
  --ink-mute: #7d8aa3;

  /* Brand neón */
  --c1: #1be4c9;   /* turquesa */
  --c2: #7a5cff;   /* violeta */
  --c3: #ff7a59;   /* coral */
  --c4: #ffd34d;   /* dorado (créditos) */
  --c5: #ff3d8b;   /* magenta */

  --ok:  #22c55e;
  --warn:#ffd34d;
  --err: #ef4444;
  --info:#3aa8ff;

  --grad-1: linear-gradient(135deg, var(--c1), var(--c2));
  --grad-2: linear-gradient(135deg, var(--c3), var(--c5));
  --grad-3: linear-gradient(135deg, var(--c4), var(--c3));
  --grad-bg: radial-gradient(1200px 800px at 80% -200px, #182446 0%, #0a1325 45%, #06080f 100%),
             radial-gradient(900px 500px at -10% 80%, #3a0d4a 0%, rgba(58,13,74,.2) 55%, rgba(0,0,0,0) 75%);

  --shadow-sm: 0 2px 10px rgba(0,0,0,.30);
  --shadow:    0 10px 40px rgba(0,0,0,.45);
  --shadow-hi: 0 18px 70px rgba(0,0,0,.55);
  --glow-c1:   0 0 22px rgba(27, 228, 201, 0.45);
  --glow-c2:   0 0 22px rgba(122, 92, 255, 0.45);
  --glow-c3:   0 0 22px rgba(255, 122, 89, 0.45);

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 32px;
  --r-pill: 999px;

  --t-fast: 120ms cubic-bezier(.2,.8,.2,1);
  --t-med:  220ms cubic-bezier(.2,.8,.2,1);
  --t-slow: 420ms cubic-bezier(.2,.8,.2,1);

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg-0);
  background-image: var(--grad-bg);
  background-attachment: fixed;
  line-height: 1.45;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: var(--c1); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

/* ----- Decoración de fondo (blobs) ----- */
.bgfx { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bgfx .blob {
  position: absolute;
  filter: blur(80px);
  opacity: .25;
  border-radius: 50%;
}
.bgfx .b1 { width: 520px; height: 520px; left: -120px; top: -120px; background: var(--c1); animation: f1 22s ease-in-out infinite; }
.bgfx .b2 { width: 600px; height: 600px; right: -180px; top: 30%; background: var(--c2); animation: f2 28s ease-in-out infinite; }
.bgfx .b3 { width: 680px; height: 680px; left: 30%; bottom: -260px; background: var(--c3); animation: f3 32s ease-in-out infinite; }
@keyframes f1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(40px,30px)} }
@keyframes f2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-30px,40px)} }
@keyframes f3 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(40px,-30px)} }

@media (prefers-reduced-motion: reduce) {
  .bgfx .blob { animation: none; }
}

/* ----- Layout ----- */
.container { max-width: 1240px; margin: 0 auto; padding: 0 16px; position: relative; z-index: 1; }
.section { padding: 36px 0; }
.section-title { font-family: var(--font-display); font-weight: 800; font-size: 28px; letter-spacing: -0.3px; margin: 0 0 16px; }
.section-title .accent {
  background: var(--grad-1);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* ----- Navbar ----- */
.navbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background: rgba(8,12,20,.65);
  border-bottom: 1px solid var(--border);
}
.navbar .container { display: flex; align-items: center; gap: 14px; padding: 12px 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-family: var(--font-display); font-size: 20px; color: var(--ink); letter-spacing: -.4px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--grad-1);
  display: grid; place-items: center;
  box-shadow: var(--glow-c1);
  font-weight: 900; color: #06080f; font-size: 20px;
}
.brand-name .ct-h { color: var(--c1); }
.nav-spacer { flex: 1; }
.nav-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--ink); cursor: pointer;
  transition: var(--t-fast);
  position: relative;
}
.icon-btn:hover { background: var(--surface-hi); border-color: var(--border-hi); }
.icon-btn .badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--c5);
  color: #fff; font-size: 11px; font-weight: 800;
  display: grid; place-items: center;
}

/* ----- Botones ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--r-pill);
  font-family: var(--font); font-weight: 700; font-size: 15px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--ink); cursor: pointer;
  transition: var(--t-fast);
  text-decoration: none; line-height: 1;
}
.btn:hover { background: var(--surface-hi); border-color: var(--border-hi); transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--grad-1); border: none; color: #06080f;
  box-shadow: var(--glow-c1);
}
.btn-primary:hover { filter: brightness(1.07); box-shadow: 0 0 32px rgba(27,228,201,.55); }

.btn-hot {
  background: var(--grad-2); border: none; color: #fff;
  box-shadow: var(--glow-c3);
}
.btn-gold {
  background: var(--grad-3); border: none; color: #1a0e00;
  box-shadow: 0 0 22px rgba(255,211,77,.45);
}
.btn-ghost { background: transparent; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 16px 28px; font-size: 17px; }
.btn-block { width: 100%; }

/* ----- Pills / Chips ----- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
}
.pill.gold { background: rgba(255,211,77,.12); border-color: rgba(255,211,77,.4); color: var(--c4); }
.pill.violet { background: rgba(122,92,255,.12); border-color: rgba(122,92,255,.4); color: #b5a5ff; }
.pill.teal { background: rgba(27,228,201,.12); border-color: rgba(27,228,201,.4); color: var(--c1); }
.pill.coral { background: rgba(255,122,89,.12); border-color: rgba(255,122,89,.4); color: var(--c3); }
.pill.ok { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.4); color: var(--ok); }
.pill.err { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.4); color: var(--err); }

/* ----- Cards genéricas ----- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 18px;
  backdrop-filter: blur(6px);
}

/* ----- HERO ----- */
.hero {
  padding: 56px 0 32px;
  text-align: center;
}
.hero h1 {
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(34px, 6vw, 64px); line-height: 1.04;
  letter-spacing: -1.2px; margin: 0 0 14px;
}
.hero h1 .grad-1 { background: var(--grad-1); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero h1 .grad-2 { background: var(--grad-2); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero .lead { font-size: clamp(15px, 2.2vw, 19px); color: var(--ink-soft); max-width: 640px; margin: 0 auto 22px; }
.hero .cta-row { display: inline-flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* ----- Stats hero ----- */
.hero-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 22px; }
.hero-stats .stat {
  background: var(--surface); border: 1px solid var(--border);
  padding: 10px 16px; border-radius: var(--r-pill);
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-soft);
}
.hero-stats .stat .v { font-weight: 800; color: var(--ink); }
.hero-stats .stat .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c1); box-shadow: var(--glow-c1); }

/* ----- Filtros categorías ----- */
.category-bar {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin: 6px 0 20px;
}
.cat-pill {
  padding: 8px 16px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--ink-soft); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: var(--t-fast);
}
.cat-pill:hover { color: var(--ink); }
.cat-pill.active {
  background: var(--grad-1); color: #06080f; border-color: transparent;
  box-shadow: var(--glow-c1);
}

/* ----- Grid de juegos ----- */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.game-card {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  aspect-ratio: 3/4;
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--t-med);
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column;
}
.game-card:hover { transform: translateY(-4px); border-color: var(--border-hi); box-shadow: var(--shadow-hi); text-decoration: none; }
.game-card .cover {
  flex: 1; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--c2), var(--c1));
  display: grid; place-items: center;
}
.game-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.game-card .cover .emoji { font-size: 56px; filter: drop-shadow(0 4px 18px rgba(0,0,0,.5)); }
.game-card .info {
  padding: 12px;
  background: linear-gradient(180deg, rgba(0,0,0,0), rgba(8,12,20,.92));
  position: absolute; left: 0; right: 0; bottom: 0;
}
.game-card .info .title { font-weight: 800; font-size: 15px; margin: 0 0 4px; }
.game-card .info .meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--ink-mute); }
.game-card .badge-cat {
  position: absolute; top: 8px; left: 8px;
  padding: 4px 10px; border-radius: var(--r-pill);
  background: rgba(0,0,0,.5); backdrop-filter: blur(6px);
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
}
.game-card .badge-play {
  position: absolute; top: 8px; right: 8px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--grad-1); display: grid; place-items: center;
  box-shadow: var(--glow-c1);
  opacity: 0; transition: var(--t-med);
}
.game-card:hover .badge-play { opacity: 1; }

/* Colores por categoría */
.game-card[data-cat="tap"] .cover     { background: linear-gradient(135deg,#ff3d8b,#ff7a59); }
.game-card[data-cat="reflex"] .cover  { background: linear-gradient(135deg,#1be4c9,#3aa8ff); }
.game-card[data-cat="aim"] .cover     { background: linear-gradient(135deg,#7a5cff,#ff3d8b); }
.game-card[data-cat="memory"] .cover  { background: linear-gradient(135deg,#ffd34d,#ff7a59); }
.game-card[data-cat="puzzle"] .cover  { background: linear-gradient(135deg,#3aa8ff,#7a5cff); }
.game-card[data-cat="luck"] .cover    { background: linear-gradient(135deg,#22c55e,#1be4c9); }

/* ----- Forms ----- */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; margin: 0 0 6px; font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 12px 14px;
  background: var(--bg-1); color: var(--ink);
  border: 1px solid var(--border); border-radius: var(--r-md);
  font-family: var(--font); font-size: 15px;
  transition: var(--t-fast);
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none; border-color: var(--c1); box-shadow: 0 0 0 3px rgba(27,228,201,.15);
}

/* ----- Modales ----- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(6,8,15,.7);
  backdrop-filter: blur(8px);
  display: grid; place-items: center;
  padding: 16px;
  animation: fadeIn var(--t-med);
}
.modal {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--r-lg); max-width: 480px; width: 100%;
  box-shadow: var(--shadow-hi);
  animation: pop var(--t-med);
}
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.modal-head h3 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 20px; flex: 1; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
@keyframes pop { from{transform:scale(.94); opacity:0} to{transform:scale(1); opacity:1} }

/* ----- Toast ----- */
.toast-stack { position: fixed; top: 80px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-2); border: 1px solid var(--border);
  border-left: 4px solid var(--c1);
  border-radius: var(--r-md); padding: 12px 16px;
  min-width: 240px; max-width: 360px;
  box-shadow: var(--shadow);
  animation: slideIn var(--t-med);
  font-size: 14px;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
.toast.warn { border-left-color: var(--warn); }
@keyframes slideIn { from{transform:translateX(20px); opacity:0} to{transform:translateX(0); opacity:1} }

/* ----- Table de ranking ----- */
.rank-list { display: flex; flex-direction: column; gap: 6px; }
.rank-row {
  display: grid; grid-template-columns: 38px 40px 1fr auto auto; gap: 12px; align-items: center;
  padding: 10px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.rank-pos { font-family: var(--font-display); font-weight: 900; font-size: 18px; color: var(--ink-mute); text-align: center; }
.rank-row.r1 .rank-pos { color: var(--c4); }
.rank-row.r2 .rank-pos { color: #d8e1ee; }
.rank-row.r3 .rank-pos { color: #c08866; }
.rank-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--bg-2); }
.rank-name { font-weight: 700; }
.rank-meta { font-size: 12px; color: var(--ink-mute); }

/* ----- Footer ----- */
footer.site-footer {
  margin-top: 60px; padding: 30px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--ink-mute);
  font-size: 13px;
}
footer.site-footer a { color: var(--ink-soft); margin: 0 8px; }

/* ----- Mobile ----- */
@media (max-width: 720px) {
  .games-grid { grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 10px; }
  .game-card { aspect-ratio: 3/4; }
  .game-card .info .title { font-size: 13px; }
  .section { padding: 24px 0; }
  .section-title { font-size: 22px; }
  .hero { padding: 32px 0 18px; }
  .nav-actions .btn-lg, .nav-actions .btn { padding: 8px 14px; font-size: 13px; }
  .brand-name { font-size: 17px; }
}

/* ----- Utilidades ----- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.text-center { text-align: center; } .text-mute { color: var(--ink-mute); } .text-soft { color: var(--ink-soft); }
.text-gold { color: var(--c4); } .text-teal { color: var(--c1); } .text-coral { color: var(--c3); }
.fw-800 { font-weight: 800; } .fw-700 { font-weight: 700; }
.display { font-family: var(--font-display); }
