/* juego.css
   Estilo "videojuego retro" compartido por la portada y el catálogo: la web
   entera se siente parte de la tienda pixel. Paleta de El Dragon (rojo
   dragón, fuego y oro) sobre fondo oscuro con textura de píxeles. */

:root {
  --fondo: #0f0908;
  --fondo-2: #170e0c;
  --superficie: #1f1411;
  --superficie-2: #2b1c17;
  --borde: #4d2c22;
  --borde-claro: #7a4632;
  --texto: #f7ede7;
  --texto-2: #c9ae9f;
  --rojo: #e0452b;
  --rojo-oscuro: #8f2615;
  --fuego: #ff8a3d;
  --oro: #f2c14e;
  --oro-oscuro: #9a6b12;
  --verde: #44d07a;
  --verde-oscuro: #1f7a43;
  --peligro: #ff7777;
  --pixel: 'Silkscreen', monospace;
  /* rarezas (por precio): común, rara, épica, legendaria */
  --comun: #8d8a99;
  --rara: #4aa3ff;
  --epica: #b56bff;
  --legendaria: #f2c14e;
  --ancho: 1180px;
  /* esquinas recortadas "de píxel" */
  --muesca: 4px;
  --recorte: polygon(0 var(--muesca), var(--muesca) var(--muesca), var(--muesca) 0,
    calc(100% - var(--muesca)) 0, calc(100% - var(--muesca)) var(--muesca), 100% var(--muesca),
    100% calc(100% - var(--muesca)), calc(100% - var(--muesca)) calc(100% - var(--muesca)),
    calc(100% - var(--muesca)) 100%, var(--muesca) 100%, var(--muesca) calc(100% - var(--muesca)),
    0 calc(100% - var(--muesca)));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body {
  margin: 0; color: var(--texto); line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--fondo);
  /* textura de píxeles muy suave */
  background-image:
    linear-gradient(45deg, rgba(255,255,255,.012) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.012) 75%),
    linear-gradient(45deg, rgba(255,255,255,.012) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.012) 75%);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
}
a { color: inherit; }
img { max-width: 100%; }
.contenedor { max-width: var(--ancho); margin: 0 auto; padding: 0 16px; }
.pixel { font-family: var(--pixel); }
.oculto-visual { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* --- Paneles con marco pixel --- */
.panel {
  position: relative; background: var(--superficie);
  clip-path: var(--recorte);
  box-shadow:
    inset 0 0 0 3px var(--borde),
    inset 0 0 0 4px #000,
    inset 3px 3px 0 4px rgba(255,255,255,.04);
  padding: 18px;
}
.panel.claro { background: var(--superficie-2); }

/* --- Botones de juego (se hunden al apretarlos) --- */
.btn {
  --c: var(--superficie-2); --c-borde: var(--borde-claro); --c-texto: var(--texto);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--pixel); font-size: 15px; letter-spacing: .5px; text-transform: uppercase;
  text-decoration: none; color: var(--c-texto); background: var(--c); border: none; cursor: pointer;
  padding: 12px 20px 14px; clip-path: var(--recorte);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.35), inset 0 3px 0 rgba(255,255,255,.22), inset 0 0 0 2px var(--c-borde);
  transition: transform .06s, filter .12s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(0,0,0,.35), inset 0 2px 0 rgba(255,255,255,.18), inset 0 0 0 2px var(--c-borde); }
.btn:disabled { filter: grayscale(1) brightness(.6); cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 3px solid var(--oro); outline-offset: 2px; }
.btn-rojo { --c: var(--rojo); --c-borde: #ff7a5c; --c-texto: #fff; }
.btn-oro { --c: var(--oro); --c-borde: #ffe08a; --c-texto: #2a1700; }
.btn-verde { --c: #2fae5c; --c-borde: #6ff09a; --c-texto: #fff; }
.btn-grande { font-size: 18px; padding: 16px 28px 19px; }
.btn-chico { font-size: 12px; padding: 8px 12px 10px; }

/* parpadeo de "PRESIONA START" */
@keyframes latido { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
.latido { animation: latido 1.6s ease-in-out infinite; }
@keyframes parpadeo { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.cursor::after { content: '▮'; margin-left: 4px; animation: parpadeo 1s steps(1) infinite; }

/* --- Títulos de sección estilo juego --- */
.titulo-juego { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.titulo-juego small { display: block; font-family: var(--pixel); font-size: 12px; letter-spacing: 1px; color: var(--oro); text-transform: uppercase; }
.titulo-juego h2 {
  font-family: var(--pixel); font-weight: 700; font-size: clamp(22px, 3.6vw, 32px); line-height: 1.15;
  margin: 6px 0 0; text-transform: uppercase; letter-spacing: .5px;
  text-shadow: 3px 3px 0 var(--rojo-oscuro);
}
.enlace-juego { font-family: var(--pixel); font-size: 13px; color: var(--fuego); text-decoration: none; text-transform: uppercase; white-space: nowrap; }
.enlace-juego:hover { color: var(--oro); }
.enlace-juego::after { content: ' ▶'; }

/* --- Ítems (productos como objetos de inventario) --- */
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.item {
  --rareza: var(--comun);
  position: relative; display: flex; flex-direction: column; text-decoration: none; color: inherit;
  background: var(--superficie); clip-path: var(--recorte);
  box-shadow: inset 0 0 0 3px var(--rareza), inset 0 0 0 5px #000;
  transition: transform .12s, filter .12s;
  scroll-margin-top: 90px;
}
a.item:hover, .item:focus-within { transform: translateY(-3px); filter: brightness(1.08); }
.item.rara { --rareza: var(--rara); }
.item.epica { --rareza: var(--epica); }
.item.legendaria { --rareza: var(--legendaria); }
.item.resaltado { animation: latido 1.2s ease-in-out 3; }
.item-foto {
  position: relative; margin: 5px 5px 0; aspect-ratio: 4 / 3; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #3a2620, #170e0c);
}
.item-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-foto .sin-foto {
  width: 100%; height: 100%; display: grid; place-items: center; text-align: center; padding: 10px;
  font-family: var(--pixel); font-size: 22px; color: rgba(255,255,255,.9); text-shadow: 2px 2px 0 rgba(0,0,0,.4);
}
.item-cantidad {
  position: absolute; right: 6px; bottom: 6px; font-family: var(--pixel); font-size: 14px; font-weight: 700;
  color: #fff; text-shadow: 2px 0 #000, -2px 0 #000, 0 2px #000, 0 -2px #000;
}
.item-cinta {
  position: absolute; left: 0; top: 8px; font-family: var(--pixel); font-size: 11px; padding: 3px 8px 3px 6px;
  background: var(--rojo); color: #fff; clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 50%, 100% 100%, 0 100%);
}
.item-cinta.oro { background: var(--oro); color: #2a1700; }
.item-cinta.gris { background: #3a3a44; color: #ddd; }
.item-cinta.verde { background: #2fae5c; color: #fff; }
.item-cuerpo { padding: 10px 14px 14px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.item-rareza { font-family: var(--pixel); font-size: 10px; letter-spacing: .5px; text-transform: uppercase; color: var(--rareza); }
.item-nombre { font-weight: 700; font-size: 15px; line-height: 1.3; }
.item-desc { font-size: 12px; color: var(--texto-2); line-height: 1.35; }
.item-pie { margin-top: auto; padding-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.moneda { display: inline-flex; align-items: center; gap: 6px; font-family: var(--pixel); font-size: 18px; color: var(--oro); white-space: nowrap; }
.moneda::before {
  content: ''; width: 12px; height: 12px; flex: none;
  background: radial-gradient(circle at 35% 35%, #ffe9a8 0 25%, var(--oro) 26% 60%, var(--oro-oscuro) 61%);
  clip-path: polygon(25% 0, 75% 0, 100% 25%, 100% 75%, 75% 100%, 25% 100%, 0 75%, 0 25%);
}
.item-stock { font-size: 11px; color: var(--texto-2); text-align: right; }

/* --- Cuadro de diálogo RPG --- */
.dialogo { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
.retrato {
  width: 88px; height: 88px; flex: none; image-rendering: pixelated;
  background: radial-gradient(circle at 50% 60%, #3a2620, #1a100d); clip-path: var(--recorte);
  box-shadow: inset 0 0 0 3px var(--borde-claro), inset 0 0 0 4px #000;
}
.dialogo-quien { font-family: var(--pixel); font-size: 12px; color: var(--oro); text-transform: uppercase; letter-spacing: .5px; }
.dialogo-texto { margin: 4px 0 0; font-size: 15px; line-height: 1.5; }

/* --- Pastilla de estado (abierto/cerrado) --- */
.estado-tienda {
  font-family: var(--pixel); font-size: 12px; padding: 5px 10px; white-space: nowrap; color: var(--texto-2);
  background: #000; clip-path: var(--recorte);
}
.estado-tienda::before { content: '●'; margin-right: 6px; color: #ff6b6b; }
.estado-tienda.abierta { color: #c6f5d6; }
.estado-tienda.abierta::before { color: var(--verde); animation: parpadeo 1.4s steps(1) infinite; }

@media (prefers-reduced-motion: reduce) {
  .latido, .item.resaltado, .estado-tienda.abierta::before, .cursor::after { animation: none; }
  html { scroll-behavior: auto; }
}
