/* Estética 8-bit: NES.css + Press Start 2P para la UI, Pixelify Sans para leer. */
:root {
  --bg: #16181d;
  --bg2: #212529;
  --surface: #212529;
  --line: #ffffff;
  --text: #f4f4f4;
  --muted: #9aa0a8;
  --like: #92cc41;
  --nope: #e76e55;
  --super: #209cee;
  --played: #f7d51d;
  --plat: #92cc41;
  --pixel: 'Press Start 2P', monospace;
  --read: 'Pixelify Sans', system-ui, sans-serif;
  --head: 60px;
  --tabs: calc(68px + env(safe-area-inset-bottom));
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 var(--read);
  min-height: 100dvh;
}
a { color: inherit; }
a:hover { color: inherit; text-decoration: none; }
h1, h2, h3, .logo, .stamp, legend, .nes-btn, .tab, .chip { font-family: var(--pixel); font-weight: 400; letter-spacing: 0; }
.ic { width: 24px; height: 24px; flex: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.blink { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* NES.css trae márgenes en botones/containers: los controlamos acá */
.nes-btn { margin: 0; font-size: 11px; line-height: 1.4; padding: 8px 12px; text-decoration: none; }
.nes-btn .ic { width: 16px; height: 16px; vertical-align: -3px; }
.nes-container.is-dark { margin: 0; background: var(--surface); }
.nes-btn.mini { font-size: 9px; padding: 6px 8px; display: inline-flex; align-items: center; gap: 6px; }
.nes-btn.mini .ic { width: 12px; height: 12px; vertical-align: 0; }
.nes-btn.wide { width: 100%; font-size: 13px; padding: 14px; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 50;
  height: var(--head); padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg);
}
.logo { font-size: 15px; text-decoration: none; }
.logo span { color: var(--plat); }
.plat-chip { display: inline-flex; align-items: center; gap: 8px; font: 9px var(--pixel); text-decoration: none; color: var(--muted); }
.plat-chip i { width: 8px; height: 8px; background: var(--plat); }

/* ---------- tabs: barra abajo en celu, dock flotante en desktop ---------- */
.page { padding: 0 16px calc(var(--tabs) + 24px); max-width: 980px; margin: 0 auto; }
.tabs {
  position: fixed; z-index: 60; left: 0; right: 0; bottom: 0;
  height: var(--tabs); padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: var(--bg2); border-top: 4px solid var(--line);
}
.tab {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; color: var(--muted); font-size: 8px;
}
.tab.on { color: var(--text); }
.tab.on .ic { color: var(--plat); }
.badge {
  position: absolute; top: 6px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--nope); color: #fff; font: 8px/18px var(--pixel); text-align: center;
}
@media (min-width: 900px) {
  .page { padding: 8px 32px 48px 130px; }
  .tabs {
    left: 24px; right: auto; top: 50%; bottom: auto; transform: translateY(-50%);
    width: 84px; height: auto; padding: 8px 0; flex-direction: column; gap: 2px;
    border: 4px solid var(--line);
  }
  .tab { padding: 12px 0; margin: 0 6px; }
  .tab:hover { color: var(--text); background: #ffffff10; }
  .tab.on { background: #ffffff14; }
  .badge { top: 4px; left: auto; right: 4px; }
}

/* ---------- descubrir ---------- */
.moods {
  display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -16px; padding: 6px 18px 16px;
}
.moods::-webkit-scrollbar { display: none; }
.mood { flex: none; font-size: 9px; padding: 6px 10px; white-space: nowrap; }

body.no-scroll { overflow: hidden; }
.page-descubrir { display: flex; flex-direction: column; height: calc(100dvh - var(--head)); padding-bottom: var(--tabs); }
.deck-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; }
.deck { position: relative; flex: 1; min-height: 0; width: 100%; max-width: 480px; margin-top: 4px; }
.card.nes-container {
  position: absolute; inset: 0; padding: 0; overflow: hidden;
  display: flex; flex-direction: column; touch-action: none; user-select: none; -webkit-user-select: none;
  transition: transform .3s steps(6), opacity .3s;
  will-change: transform;
}
.card:first-child { z-index: 3; }
.card:nth-child(2) { z-index: 2; transform: translateY(10px) scale(.95); opacity: .5; }
.card:nth-child(n+3) { transform: translateY(20px) scale(.9); opacity: 0; }
.card:not(:first-child) { pointer-events: none; }
.card-bg { display: none; }
.media { position: relative; aspect-ratio: 16/9; flex: none; background: #000; overflow: hidden; border-bottom: 4px solid var(--line); }
.media img, .media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.media video { opacity: 0; }
.media video.ready { opacity: 1; }
.media .still.kb { animation: kenburns 7s ease-in-out infinite alternate; }
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.1); } }
.bars { position: absolute; top: 8px; left: 10px; right: 10px; display: flex; gap: 4px; }
.bars i { flex: 1; height: 4px; background: #fff4; }
.bars i.on { background: #fff; }
.mute {
  position: absolute; right: 8px; bottom: 8px; width: 40px; height: 40px;
  display: grid; place-items: center; border: 0; background: #000b; color: #fff;
}
.mute .ic { width: 22px; height: 22px; }
.mute .i-on, .mute.on .i-off { display: none; }
.mute.on .i-on { display: block; }
.info { position: relative; flex: 1; min-height: 0; padding: 14px 16px 16px; display: flex; flex-direction: column; overflow: hidden; }
.info h2 { margin: 10px 0 8px; font-size: clamp(13px, 3.8vw, 17px); line-height: 1.45; }
.meta { margin: 0 0 8px; color: var(--muted); font-size: 15px; }
.desc { margin: 0; font-size: 16px; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.card.open .desc { -webkit-line-clamp: unset; overflow-y: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 4px 6px; font-size: 8px; line-height: 1.3; background: #fff; color: #212529; }
.chip.gp { background: var(--like); }
.chip.warn { background: var(--played); }
.chip.on { background: var(--super); color: #fff; }

.stamp {
  position: absolute; z-index: 5; top: 24px; padding: 8px 10px; border: 4px solid;
  font-size: 18px; opacity: 0; pointer-events: none; background: #000c;
}
.s-like { left: 16px; color: var(--like); transform: rotate(-10deg); }
.s-nope { right: 16px; color: var(--nope); transform: rotate(10deg); }
.s-super { left: 50%; top: 38%; color: var(--super); transform: translateX(-50%); }
.s-played { left: 50%; top: 38%; color: var(--played); transform: translateX(-50%); }

.actions { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 18px 0 8px; }
.act.nes-btn { width: 58px; height: 58px; padding: 0; display: grid; place-items: center; }
.act.nes-btn .ic { width: 28px; height: 28px; vertical-align: 0; }
.act.sm.nes-btn { width: 44px; height: 44px; }
.act.sm.nes-btn .ic { width: 20px; height: 20px; }
.kbd-hint { display: none; margin: 8px 0 0; color: var(--muted); font-size: 14px; }
@media (min-width: 900px) and (hover: hover) { .kbd-hint { display: block; } }
@media (min-width: 900px) { .deck { max-width: 560px; } }
@media (max-height: 640px) { .act.nes-btn { width: 48px; height: 48px; } .act.sm.nes-btn { width: 38px; height: 38px; } .actions { padding-top: 12px; } }

.loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: var(--surface); border: 4px solid var(--line); font: 12px var(--pixel); color: var(--muted);
}

/* ---------- vacíos ---------- */
.empty { text-align: center; padding: 48px 16px; max-width: 420px; margin: 0 auto; }
.empty h2 { font-size: 14px; line-height: 1.6; margin: 0 0 20px; }
.deck .empty { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.big { font-size: 48px; line-height: 1; margin-bottom: 16px; }
form { margin: 0; }

/* ---------- lista ---------- */
.h1 { font-size: 18px; margin: 8px 0 22px; line-height: 1.5; }
.sec { margin-bottom: 30px; }
.sec h2 { font-size: 12px; margin: 0 0 6px; display: flex; align-items: baseline; gap: 10px; }
.sec h2 small { color: var(--muted); font-size: 10px; }
.sec-playing h2 { color: var(--like); }
.hint { color: var(--muted); font-size: 15px; margin: 2px 0 12px; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; gap: 12px; padding: 14px 0; border-bottom: 2px dashed #ffffff30; min-width: 0; }
.row:last-child { border-bottom: 0; }
.thumb { flex: none; width: 112px; aspect-ratio: 16/9; overflow: hidden; background: #000; align-self: flex-start; border: 3px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.row-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row-title { font-size: 17px; font-weight: 600; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { color: var(--muted); font-size: 14px; }
.gp-t { color: var(--like); font-weight: 600; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

/* ---------- decidir ---------- */
.lead { color: var(--muted); margin-top: -10px; }
.modes { display: flex; flex-wrap: wrap; gap: 12px; margin: 18px 0 22px; }
.mode.on { background: var(--super); color: #fff; }
#arena { margin-top: 8px; }
.round-title { text-align: center; color: var(--muted); font: 10px/1.6 var(--pixel); margin: 0 0 16px; }
.round-title b { color: var(--text); font-weight: 400; }
.versus { display: grid; gap: 14px; align-items: stretch; }
@media (min-width: 700px) { .versus { grid-template-columns: 1fr auto 1fr; } }
.vs { align-self: center; justify-self: center; font: 14px var(--pixel); color: var(--nope); }
.fighter.nes-container { position: relative; text-align: left; padding: 0; overflow: hidden; color: var(--text); transition: transform .2s steps(3), opacity .3s; }
.fighter:hover { border-color: var(--like); }
.fighter.win { border-color: var(--like); transform: scale(1.02); }
.fighter.lose { opacity: .25; transform: scale(.96); }
.fighter .f-body { padding: 12px 14px 14px; }
.fighter h3 { margin: 0 0 6px; font-size: 12px; line-height: 1.5; }
.fighter p { margin: 0; color: var(--muted); font-size: 15px; }
.fighter .sup { position: absolute; top: 8px; left: 8px; z-index: 2; background: var(--super); color: #fff; }
.wheel-wrap { position: relative; max-width: 440px; margin: 0 auto; }
.wheel-wrap canvas { width: 100%; height: auto; display: block; }
.wheel-pin {
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%); width: 0; height: 0; z-index: 2;
  border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 26px solid var(--nope);
}
.center { text-align: center; margin-top: 18px; }
#dice { transition: transform .08s steps(2); }

.winner {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: #000e;
}
.winner-card.nes-container { width: 100%; max-width: 620px; padding: 0; overflow: hidden; animation: pop .4s steps(5); }
@keyframes pop { from { transform: scale(.5); opacity: 0; } }
.winner-card .w-body { padding: 18px 18px 20px; }
.winner-card small { color: var(--played); font: 10px var(--pixel); }
.winner-card h2 { margin: 12px 0 20px; font-size: 16px; line-height: 1.5; }
.w-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.w-actions > * { flex: 1 1 140px; }
.w-actions form button { width: 100%; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 101; image-rendering: pixelated; }

/* ---------- ficha ---------- */
.detail { max-width: 860px; margin: 0 auto; }
.detail-media { position: relative; aspect-ratio: 16/9; overflow: hidden; background: #000; border: 4px solid var(--line); }
.detail-media img, .detail-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.detail-media video { object-fit: contain; background: #000; }
.detail-body h1 { font-size: 18px; margin: 18px 0 8px; line-height: 1.5; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; align-items: center; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.shots img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; border: 3px solid var(--line); }
.detail .chips { margin-top: 16px; }

/* ---------- ajustes ---------- */
.settings { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 26px; padding-top: 8px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-size: 12px; margin-bottom: 16px; line-height: 1.5; }
.plats, .segs { display: flex; flex-direction: column; gap: 14px; padding-left: 22px; }
.plat, .seg { cursor: pointer; font-size: 17px; }
.plat span::after { content: ''; display: inline-block; width: 10px; height: 10px; margin-left: 10px; background: var(--c); }
.settings:not(:has(input[value="xbox"]:checked, input[value="pc"]:checked)) .gp-field { display: none; }
.nes-select { margin: 0; }
.nes-select select { font: 16px var(--read); }
.danger { max-width: 560px; margin: 36px auto 0; padding-top: 22px; border-top: 2px dashed #ffffff30; }
.danger h2 { margin: 0 0 8px; font-size: 12px; }
.danger form { display: inline-block; margin: 8px 8px 0 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
