@font-face {
  font-family: "Pixelify Sans";
  src: url("fonts/pixelify-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Press Start 2P";
  src: url("fonts/press-start-2p.woff2") format("woff2");
  font-display: swap;
}

:root {
  --bg: #07060d;
  --panel: rgba(20, 14, 34, .78);
  --panel-solid: #140e22;
  --border: rgba(255, 255, 255, .09);
  --text: #f1ecff;
  --muted: #a69cc4;
  --accent: #ffcc33;   /* oro */
  --pink: #ff3e8a;
  --cyan: #3ee8ff;
  --radius: 14px;
  --pixel: "Press Start 2P", ui-monospace, monospace;
  --pixel-soft: "Pixelify Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;   /* sin background: taparía el canvas del fondo (z-index negativo) */
}
a { color: inherit; text-decoration: none; }

/* ---------- Fondo ---------- */
#bg {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: -2;
  image-rendering: pixelated;
}
/* Scanlines + viñeta tipo CRT */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,.18) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.65) 100%);
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--pixel); font-size: .72rem; line-height: 1;
  padding: 14px 18px;
  color: #1a0f00; background: var(--accent);
  border: 0; border-radius: 4px; cursor: pointer;
  box-shadow: 0 4px 0 #b3790a, 0 0 24px rgba(255, 204, 51, .35);
  transition: transform .08s, box-shadow .08s, filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #b3790a, 0 0 16px rgba(255, 204, 51, .3); }
.btn.alt {
  color: var(--text); background: rgba(62, 232, 255, .08);
  box-shadow: inset 0 0 0 2px var(--cyan), 0 4px 0 #0e6170, 0 0 24px rgba(62, 232, 255, .2);
}
.btn.alt:active { box-shadow: inset 0 0 0 2px var(--cyan), 0 1px 0 #0e6170; }
.btn.sm { padding: 10px 12px; font-size: .6rem; }

/* ---------- Barra superior ---------- */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  background: rgba(7, 6, 13, .75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.bar .title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .title strong { font-family: var(--pixel-soft); font-size: 1.15rem; }
.bar .title span { color: var(--muted); font-size: .9rem; margin-left: 6px; }
.back { color: var(--muted); font-family: var(--pixel-soft); }
.back:hover { color: var(--cyan); }

/* ---------- Portada ---------- */
.hero {
  padding: 72px 16px 40px;
  text-align: center;
}
.hero .kicker {
  font-family: var(--pixel); font-size: .62rem; letter-spacing: .12em;
  color: var(--cyan); text-shadow: 0 0 10px rgba(62, 232, 255, .7);
  margin: 0 0 18px;
}
.hero h1 {
  margin: 0;
  font-family: var(--pixel);
  font-size: clamp(1.5rem, 6.2vw, 3.4rem);
  line-height: 1.25;
  color: #fff;
  text-shadow:
    3px 3px 0 var(--pink),
    -3px -3px 0 rgba(62, 232, 255, .8),
    0 0 30px rgba(255, 62, 138, .55);
  animation: glitch 6s infinite steps(1);
}
.hero p.sub {
  font-family: var(--pixel-soft); font-size: 1.25rem;
  color: var(--muted); margin: 18px auto 0; max-width: 34rem;
}
.hero-links { margin-top: 32px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

@keyframes glitch {
  0%, 92%, 100% { transform: none; }
  93% { transform: translate(-3px, 1px) skewX(-6deg); text-shadow: -4px 0 0 var(--cyan), 4px 0 0 var(--pink); }
  95% { transform: translate(3px, -1px); }
  97% { transform: translate(-1px, 0) skewX(3deg); }
}
.blink { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

main { max-width: 1160px; margin: 0 auto; padding: 0 16px 64px; }

.section-title {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--pixel); font-size: .8rem; letter-spacing: .06em; font-weight: 400;
  color: var(--accent); margin: 40px 0 18px;
  text-shadow: 0 0 12px rgba(255, 204, 51, .45);
}
.section-title::after { content: ""; flex: 1; height: 2px; background: linear-gradient(90deg, rgba(255,204,51,.5), transparent); }

.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(6px);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--pink);
  box-shadow: 0 0 0 1px var(--pink), 0 12px 40px rgba(255, 62, 138, .3);
}
.cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #2a1650, #4a1436);
  display: grid; place-items: center;
  overflow: hidden;
}
.cover img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; transition: transform .3s; }
.card:hover .cover img { transform: scale(1.05); }
.cover span { font-family: var(--pixel); font-size: 3rem; color: rgba(255,255,255,.25); }
.cover .play {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--pixel); font-size: .8rem; color: #fff;
  background: rgba(7, 6, 13, .55);
  opacity: 0; transition: opacity .18s;
}
.cover .play b {
  padding: 12px 16px; border-radius: 4px;
  background: var(--accent); color: #1a0f00; font-weight: 400;
  box-shadow: 0 4px 0 #b3790a;
}
.card:hover .play { opacity: 1; }
.cover .badge {
  position: absolute; top: 10px; left: 10px;
  font-family: var(--pixel); font-size: .5rem; color: #04232a;
  padding: 6px 8px; border-radius: 3px;
  background: var(--cyan);
  box-shadow: 0 0 14px rgba(62, 232, 255, .6);
}
.meta { padding: 14px 16px 18px; }
.meta h2 { margin: 0; font-family: var(--pixel-soft); font-size: 1.35rem; line-height: 1.2; }
.author { margin: 4px 0 0; color: var(--accent); font-size: .9rem; }
.desc { margin: 8px 0 0; color: var(--muted); font-size: .92rem; }

.empty { text-align: center; color: var(--muted); padding: 16px; margin: 0; }

/* ---------- Panel (contenedor genérico) ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.panel-head h3 {
  margin: 0; font-family: var(--pixel); font-size: .7rem; font-weight: 400; letter-spacing: .05em; color: var(--accent);
}
.panel-head a { font-size: .85rem; color: var(--cyan); }
.panel-head a:hover { text-decoration: underline; }
.live {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--pixel); font-size: .5rem; color: #ff6b9b;
}
.live::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--pink); box-shadow: 0 0 8px var(--pink);
  animation: blink 1.4s steps(1) infinite;
}

/* ---------- Tablas de puntuaciones ---------- */
.table-wrap { overflow-x: auto; }
.scores { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.scores th, .scores td { padding: 10px 14px; text-align: left; white-space: nowrap; }
.scores th {
  color: var(--muted); font-size: .7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
}
.scores tbody tr + tr td { border-top: 1px solid rgba(255,255,255,.05); }
.scores tbody tr { transition: background .15s; }
.scores tbody tr:hover { background: rgba(255,255,255,.04); }
.scores .num { text-align: right; }
.scores .pos { width: 3rem; text-align: center; font-weight: 700; color: var(--muted); }
.scores .name { font-weight: 600; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; }
.scores .pts { color: var(--accent); font-family: var(--pixel); font-size: .75rem; }
.scores .podium .pos { font-size: 1.2rem; }
.scores .p1 { background: linear-gradient(90deg, rgba(255,204,51,.12), transparent 70%); }
.scores .p2 { background: linear-gradient(90deg, rgba(200,210,230,.08), transparent 70%); }
.scores .p3 { background: linear-gradient(90deg, rgba(205,127,50,.1), transparent 70%); }
.scores .muted { color: var(--muted); font-size: .85rem; }
.scores tr.is-new td { animation: flash 2.4s ease-out; }
@keyframes flash { 0%, 30% { background: rgba(62, 232, 255, .28); } 100% { background: transparent; } }
.scores.compact th, .scores.compact td { padding: 8px 12px; }

/* ---------- Página de juego ---------- */
.stage { max-width: 1320px; padding-top: 24px; }
.frame-wrap {
  position: relative;
  width: 100%;
  margin: 0 auto;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  box-shadow:
    0 0 0 2px rgba(255, 62, 138, .6),
    0 0 0 6px rgba(7, 6, 13, .9),
    0 0 0 8px rgba(62, 232, 255, .35),
    0 0 60px rgba(255, 62, 138, .35);
}
.frame-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
.frame-wrap:fullscreen { max-width: none !important; border-radius: 0; box-shadow: none; }

.below {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px;
  margin-top: 32px; align-items: start;
}
.info-card { padding: 18px; }
.info-card h2 { margin: 0 0 4px; font-family: var(--pixel-soft); font-size: 1.6rem; line-height: 1.15; }
.info-card .desc { font-size: 1rem; }
.info-card .row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.tips { margin: 16px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: .9rem; }
.tips li { padding: 6px 0; border-top: 1px dashed var(--border); }
.tips li::before { content: "▸ "; color: var(--pink); }
.season-tag { font-size: .5rem; color: var(--muted); }

/* ---------- Marcador ---------- */
.board { padding-top: 32px; }
.board-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.board-head h1 {
  margin: 0; font-family: var(--pixel); font-weight: 400; font-size: clamp(1.1rem, 4vw, 1.8rem);
  text-shadow: 3px 3px 0 var(--pink), 0 0 24px rgba(255, 62, 138, .5);
}
.pickers { display: flex; gap: 12px; flex-wrap: wrap; }
.version-pick { color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: 8px; }
.version-pick select {
  background: var(--panel-solid); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font: inherit;
}
.version-pick select:focus { outline: 2px solid var(--cyan); outline-offset: 1px; }

.podium-wrap {
  display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 12px;
  max-width: 640px; margin: 28px auto;
}
.podium-wrap .step { text-align: center; min-width: 0; }
.podium-wrap .medal { font-size: 2rem; line-height: 1; }
.podium-wrap .who {
  font-family: var(--pixel-soft); font-size: 1.15rem; font-weight: 700; margin-top: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.podium-wrap .score { font-family: var(--pixel); font-size: .8rem; color: var(--accent); margin-top: 4px; }
.podium-wrap .stats { font-size: .75rem; color: var(--muted); margin-top: 2px; }
.podium-wrap .block {
  margin-top: 10px;
  display: grid; place-items: center;
  font-family: var(--pixel); font-size: 1.4rem; color: rgba(255,255,255,.9);
  text-shadow: 2px 2px 0 rgba(0,0,0,.35);
  border-radius: 6px 6px 0 0;
}
.podium-wrap .s1 .block { height: 120px; background: linear-gradient(#ffd75a, #b8860b); box-shadow: 0 0 40px rgba(255, 204, 51, .45); }
.podium-wrap .s2 .block { height: 84px;  background: linear-gradient(#e6ecf5, #8a94a8); }
.podium-wrap .s3 .block { height: 60px;  background: linear-gradient(#e29a5a, #8a4d1c); }
.podium-wrap .s1 .score { font-size: 1rem; }

footer {
  text-align: center; color: var(--muted); font-size: .9rem;
  padding: 24px 16px 40px;
  font-family: var(--pixel-soft);
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .home-grid, .below { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .hero { padding-top: 48px; }
  .hide-sm { display: none; }
  .scores th, .scores td { padding: 8px; }
  .bar #fs span { display: none; }
  .podium-wrap .medal { font-size: 1.5rem; }
  .podium-wrap .s1 .block { height: 90px; }
  .podium-wrap .s2 .block { height: 64px; }
  .podium-wrap .s3 .block { height: 46px; }
}
@media (max-width: 420px) {
  .hide-xs { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
