/* FUENTES RETRO */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Sixtyfour:BLED,SCAN@49,-2&display=swap');
:root {
    --primary-color: #CBAE88; /* Marrón café */
    --secondary-color: #F5EBDD; /* Beige suave */
    --accent-color: #A3C1AD; /* Verde menta apagado */
    --highlight-color: #D8A39D; /* Rosa pastel apagado */
    --text-color: #4B3B2A; /* Marrón oscuro */
}

/* FONDO VINTAGE CON GRANO Y MANCHAS */
body {
    margin: 0;
    font-family: 'Press Start 2P', monospace;
    background-color: var(--secondary-color);
    background-image: 
        repeating-linear-gradient(
            45deg,
            rgba(0,0,0,0.02),
            rgba(0,0,0,0.02) 1px,
            transparent 1px,
            transparent 20px
        ),
        url('images/coffee-stains.png'); /* textura de manchas de café */
    background-repeat: repeat;
    color: var(--text-color);
    text-align: center;
    position: relative;
    overflow-x: hidden;
    overflow-y: hidden;
}
/* Oculta scroll vertical */
body {
  overflow-y: hidden; /* Evita scroll visible */
}

/* Solo permite scroll mediante el ratón si quieres */
body.scrollable {
  overflow-y: auto; /* Permite scroll si se añade esta clase dinámicamente */
}


/* Overlay animado de grano */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><circle fill="rgba(0,0,0,0.03)" cx="1" cy="1" r="1"/></svg>');
    background-repeat: repeat;
    opacity: 0.5;
    animation: grainMove 5s linear infinite;
    z-index: 0;
}

@keyframes grainMove {
    0% { background-position: 0 0; }
    50% { background-position: 10px 10px; }
    100% { background-position: 0 0; }
}

/* HEADER ESTILO CAFÉ/DINER 50s */
header {
    background-color: var(--primary-color);
    padding: 15px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 4px solid #745b31;
}

/* TÍTULO RETRO VINTAGE */
header h1 {
    font-family: 'Sixtyfour', cursive;
    font-size: 2.4em;
    color: var(--text-color);
    text-shadow: 2px 2px #E3D9C5;
    padding: 12px 25px;
    border: 2px solid #A78B5B;
    border-radius: 12px;
    background-color: var(--secondary-color);
    box-shadow: inset 0 0 8px rgba(0,0,0,0.2);
}

/* GRILLA DE JUEGOS */
.game-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    padding: 20px 40px 40px 40px;
    justify-items: center;
    z-index: 1;
    position: relative;
}

/* TARJETAS DE JUEGO */
.game-card {
    background-color: var(--secondary-color);
    border: 3px solid var(--primary-color);
    border-radius: 12px;
    padding: 5px;
    cursor: pointer;
    width: 400px;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.2);
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    background-image: linear-gradient(45deg, rgba(0,0,0,0.02) 25%, transparent 25%, transparent 75%, rgba(0,0,0,0.02) 75%, rgba(0,0,0,0.02)),
                      linear-gradient(45deg, rgba(0,0,0,0.02) 25%, transparent 25%, transparent 75%, rgba(0,0,0,0.02) 75%, rgba(0,0,0,0.02));
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

.game-card:hover {
    transform: translateY(-5px) scale(1.03);
    border-color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-color);
}

.game-card img {
    width: 100%;
    border-radius: 10px;
    border: 2px solid #A78B5B;
    transition: transform 0.3s;
}

.game-card img:hover {
    transform: scale(1.03);
}

#gameModal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none; /* Oculto inicialmente */
  justify-content: center;
  align-items: center;
  z-index: 20000;
}

.modal-content {
  position: relative;
  width: 90vw;
  height: 90vh;
  max-width: 1200px;
  border: 4px solid #A78B5B;
  background: black;
}

#gameFrame {
  width: 100%;
  height: 100%;
}

#closeModal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2em;
    font-weight: bold;
    cursor: pointer;
    color: var(--highlight-color);
    text-shadow: 1px 1px #4B3B2A;
    transition: color 0.3s, transform 0.2s;
    z-index: 10002; /* debe estar encima de todo */
}

.crt-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        rgba(0,0,0,0.05) 0 2px,
        transparent 2px 4px
    );
    mix-blend-mode: multiply;
    pointer-events: none; /* importante para que no bloquee clics */
    z-index: 10000;
}


/* Overlay CRT vintage */
.crt-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        rgba(0,0,0,0.05) 0 2px,
        transparent 2px 4px
    );
    mix-blend-mode: multiply;
    pointer-events: none;
    z-index: 1;
}

#gameFrame {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    position: relative;
    z-index: 2;
}

#closeModal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2em;
    font-weight: bold;
    cursor: pointer;
    color: var(--highlight-color);
    text-shadow: 1px 1px #4B3B2A;
    transition: color 0.3s, transform 0.2s;
}

#closeModal:hover {
    color: var(--accent-color);
    transform: scale(1.1);
}
#achievementPopup {
  font-family: 'Press Start 2P', monospace;
  background:#fff3e0;
  border:3px solid #a0522d;
  color:#000;
  padding:10px 14px;
  border-radius:10px;
  box-shadow:0 6px 14px rgba(0,0,0,0.35);
}

/* 🔥 PANEL SUPERIOR FIJO 🔥 */
#uiPanel {
    position: fixed;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 8px;
    align-items: center;
    z-index: 99999;
}

#uiPanel .btn {
    background: black;
    color: #ffcc00;
    border: 2px solid #ffcc00;
    padding: 6px 10px;
    font-size: 11px;
    border-radius: 8px;
    cursor: pointer;
    font-family: "Press Start 2P", monospace;
    transition: 0.2s;
}

#uiPanel .btn:hover {
    background: #ffcc00;
    color: black;
}

#playerName {
    color: white;
    font-size: 11px;
    font-family: "Press Start 2P", monospace;
}
/* 🔥 PANEL FIJO ARRIBA DERECHA */
#uiPanel {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ✅ Botones estilo arcade */
.retroBtn {
    padding: 8px 12px;
    font-family: "Press Start 2P", monospace;
    background: #111;
    color: #ffcc00;
    border: 2px solid #ffcc00;
    cursor: pointer;
    border-radius: 6px;
    font-size: 10px;
    text-transform: uppercase;
    transition: 0.2s;
}

.retroBtn:hover {
    background: #ffcc00;
    color: #111;
}

#playerName {
    font-family: "Press Start 2P", monospace;
    font-size: 12px;
    color: white;
}

