* { box-sizing: border-box; font-family: 'Press Start 2P', cursive; }
body { margin: 0; padding: 0; background-image: url('fondo.png'); background-size: cover; background-position: center; background-attachment: fixed; background-color: #1a1a2e; color: white; min-height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
body::before { content: ""; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(10, 10, 20, 0.7); backdrop-filter: blur(4px); z-index: -2; }

/* SCANLINES (Game Juice retro) */
.scanlines { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06)); background-size: 100% 4px, 3px 100%; z-index: -1; pointer-events: none; opacity: 0.6; }

.hidden { display: none !important; }
.fade-transition { transition: opacity 0.4s ease; }

/* TOAST NOTIFICATIONS */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 5000; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { background: rgba(15, 15, 25, 0.95); border-left: 5px solid #ffcc00; padding: 15px 20px; border-radius: 4px; font-size: 10px; color: white; box-shadow: 0 4px 15px rgba(0,0,0,0.5); animation: slideInRight 0.3s forwards, fadeOutToast 0.3s 2.7s forwards; line-height: 1.4; }
.toast.error { border-left-color: #ff3333; }
.toast.success { border-left-color: #2ecc71; }

/* PANTALLA DE CONEXIÓN */
#connection-screen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 2000; overflow-y: auto; padding: 20px; display: flex; justify-content: center; align-items: center; }
.connection-content { display: flex; flex-direction: column; gap: 20px; text-align: center; max-width: 500px; width: 100%; animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.main-title { font-size: 36px; color: #ffcc00; text-shadow: 4px 4px 0 #3b4cca, -2px -2px 0 #2a2a2a, 0 0 15px rgba(255, 204, 0, 0.5); margin-bottom: 10px; letter-spacing: 2px; line-height: 1.4; animation: float 3s infinite ease-in-out; }
.connection-box { background: rgba(30, 30, 40, 0.85); padding: 25px; border-radius: 12px; border: 2px solid #555; box-shadow: 0 10px 30px rgba(0,0,0,0.8); width: 100%; position: relative; overflow: hidden; }
.connection-box::before { content: ""; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: linear-gradient(45deg, transparent, rgba(255,255,255,0.05), transparent); transform: rotate(45deg); pointer-events: none; }
.connection-box h2 { margin-top: 0; margin-bottom: 15px; font-size: 16px; color: #fff; border-bottom: 2px solid #444; padding-bottom: 10px; text-shadow: 2px 2px 0 #000; }
.connection-box p { font-size: 10px; color: #ccc; margin-bottom: 15px; font-family: Arial, sans-serif; }
.input-group { display: flex; flex-direction: column; gap: 12px; }
.btn-row { display: flex; gap: 10px; }
.connection-box input, #gen-selector { width: 100%; text-align: center; font-size: 14px; padding: 12px; background: rgba(10, 10, 15, 0.9); border: 2px solid #555; color: #ffcc00; font-family: 'Press Start 2P', monospace; border-radius: 6px; outline: none; transition: border-color 0.3s, box-shadow 0.3s; }
.connection-box input:focus, #gen-selector:focus { border-color: #ffcc00; box-shadow: 0 0 10px rgba(255, 204, 0, 0.3); }
#gen-selector option { background: #222; color: white; padding: 10px; }
.connection-box button { flex: 1; padding: 14px; font-size: 10px; cursor: pointer; border: none; font-weight: bold; color: white; border-radius: 6px; transition: all 0.2s; text-transform: uppercase; position: relative; overflow: hidden; }
.connection-box button:active { transform: translateY(3px) scale(0.98); }
.btn-action { background: #444; border: 2px solid #666 !important; box-shadow: 0 4px 0 #222; }
.btn-action:hover { background: #555; transform: translateY(-2px); box-shadow: 0 6px 0 #222; }
.btn-highlight { background: #e67e22; border-color: #d35400 !important; box-shadow: 0 4px 0 #a04000; }
.btn-highlight:hover { background: #d35400; box-shadow: 0 6px 0 #a04000; }
.btn-primary { background: #3b4cca; border: 2px solid #5da0ff !important; box-shadow: 0 4px 0 #202b75; font-size: 14px !important; }
.btn-primary:hover { background: #4b5cdb; transform: translateY(-2px); box-shadow: 0 6px 0 #202b75; }

/* FOOTER */
.footer-notice { margin-top: 10px; background: rgba(0, 0, 0, 0.7); border: 1px solid #333; border-radius: 8px; padding: 15px; width: 100%; text-align: center; font-size: 10px; color: rgba(255, 255, 255, 0.6); font-family: Arial, sans-serif; }
.footer-notice p { margin: 8px 0; line-height: 1.8; }
.footer-notice .divider { height: 1px; background: #333; margin: 8px auto; width: 80%; }
.footer-notice strong { color: #ffcc00; }
.footer-notice a { color: #5da0ff; text-decoration: none; font-weight: bold; transition: color 0.2s; }
.footer-notice a:hover { color: #fff; text-shadow: 0 0 5px #5da0ff; }
.license-text { font-size: 9px; margin-top: 8px; font-style: italic; line-height: 1.8; }

/* OVERLAY SELECCIÓN */
#selection-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(10,10,15,0.95); z-index: 1500; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(5px); }
#selection-container { text-align: center; animation: popIn 0.4s ease-out; }
#selection-title { color: #ffcc00; text-shadow: 3px 3px 0 #000, 0 0 15px rgba(255,204,0,0.5); margin-bottom: 25px; line-height: 1.5; }
#waiting-message { font-size: 16px; color: #2ecc71; animation: pulse 1.5s infinite; text-shadow: 2px 2px 0 #000; }

/* VS SPLASH SCREEN */
#vs-splash { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: transparent; z-index: 4000; display: flex; justify-content: center; align-items: center; pointer-events: none; overflow: hidden; }
.vs-slash { position: absolute; width: 200%; height: 30vh; background: #ff3333; transform: rotate(-15deg) scaleY(0); transform-origin: center; animation: slashAnim 0.8s cubic-bezier(0.86, 0, 0.07, 1) forwards; box-shadow: 0 0 50px red; }
.vs-text-splash { position: relative; font-size: 80px; color: white; text-shadow: 8px 8px 0 #000; transform: scale(0) skewX(-15deg); animation: vsTextAnim 0.8s 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; font-style: italic; }

/* JUEGO CONTENEDOR */
#game-container { flex-grow: 1; display: flex; align-items: center; justify-content: center; width: 100%; overflow-y: auto; padding-top: 20px; }
.boards-container { display: flex; width: 100%; padding: 20px; gap: 20px; justify-content: center; align-items: center; max-width: 1400px; }
.player-board-wrapper { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 0; }
.board-title { margin-bottom: 20px; color: #fff; text-shadow: 2px 2px 0 #000, 0 0 10px rgba(255,255,255,0.3); font-size: 16px; padding: 10px 20px; background: rgba(0,0,0,0.5); border-radius: 8px; border: 2px solid #444; }

/* CARTAS SECRETAS Y VS */
.center-targets { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 40px; flex-shrink: 0; min-width: 120px; }
.secret-card-container { display: flex; flex-direction: column; align-items: center; }
.target-label { margin-bottom: 12px; font-size: 12px; color: #ffcc00; text-shadow: 2px 2px 0 #000; background: rgba(0,0,0,0.8); padding: 6px 12px; border-radius: 5px; border: 1px solid #ffcc00; }
.vs-logo { font-size: 36px; font-weight: bold; font-style: italic; color: #ff5555; text-shadow: 3px 3px 0px #fff, 6px 6px 0px #000; }

.secret-hidden, .secret-revealed { width: 90px; height: 90px; border-radius: 12px; display: flex; justify-content: center; align-items: center; transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); position: relative; }
.secret-hidden { background: rgba(10, 10, 15, 0.8); border: 3px dashed #666; box-shadow: inset 0 0 15px rgba(0,0,0,0.8); }
.secret-hidden.assigned { border: 3px solid #ffcc00; background: linear-gradient(135deg, #2a2a2a, #111); box-shadow: 0 0 20px rgba(255, 204, 0, 0.6); }
.secret-revealed { background: rgba(255, 255, 255, 0.95); border: 4px solid #2ecc71 !important; box-shadow: 0 0 30px #2ecc71; animation: popIn 0.6s forwards; overflow: hidden; }
.secret-revealed img { width: 100%; height: 100%; object-fit: contain; }
.secret-question { font-size: 35px; color: #555; font-weight: bold; }
.assigned .secret-question { color: #ffcc00; text-shadow: 3px 3px 0 #000; animation: float 2s infinite ease-in-out; }

/* REJILLA 5x5 Y SHAKE TEMPORAL */
.grid-5x5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: 100%; max-width: 600px; padding: 10px; background: rgba(0,0,0,0.4); border-radius: 12px; border: 3px solid #333; box-shadow: inset 0 0 20px rgba(0,0,0,0.8); transition: border-color 0.3s, box-shadow 0.3s; }

.shake-board-red { animation: boardShake 0.4s cubic-bezier(.36,.07,.19,.97) both; border-color: #ff3333 !important; box-shadow: inset 0 0 20px rgba(255,51,51,0.5), 0 0 20px rgba(255,51,51,0.5) !important; }
.shake-board-green { animation: boardShake 0.4s cubic-bezier(.36,.07,.19,.97) both; border-color: #2ecc71 !important; box-shadow: inset 0 0 20px rgba(46,204,113,0.5), 0 0 20px rgba(46,204,113,0.5) !important; }

/* CARTAS POKÉMON */
.poke-card { background: rgba(240,240,240,0.95); border: 3px solid #222; border-radius: 8px; display: flex; justify-content: center; align-items: center; cursor: pointer; position: relative; overflow: hidden; aspect-ratio: 1 / 1; transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s, filter 0.3s; box-shadow: 0 4px 0 #111; }
.poke-card img { width: 90%; height: 90%; object-fit: contain; image-rendering: pixelated; transition: transform 0.2s; }
.poke-card.interactive:hover { transform: translateY(-5px) scale(1.05); box-shadow: 0 8px 15px rgba(255,204,0,0.6); border-color: #ffcc00; z-index: 10; }
.poke-card.interactive:hover img { transform: scale(1.1); }
.poke-card.interactive:active { transform: translateY(0) scale(0.95); box-shadow: 0 2px 0 #111; }

/* ESTADO ELIMINADO CON SVG ANIMADO */
.eliminated { filter: grayscale(100%) brightness(0.6); background: #222; transform: scale(0.92) !important; border-color: #555; box-shadow: inset 0 0 10px rgba(0,0,0,0.8) !important; cursor: pointer; }
.eliminated img { opacity: 0.5; }
.elimination-cross { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
.cross-line { stroke-dasharray: 100; stroke-dashoffset: 100; animation: drawCross 0.3s forwards ease-out; }
.line2 { animation-delay: 0.15s; }

/* DIÁLOGO PERSONALIZADO */
#custom-dialog-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.85); z-index: 3000; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(8px); }
#custom-dialog { background: #1e1e2d; border: 4px solid #ffcc00; border-radius: 15px; padding: 30px; text-align: center; width: 90%; max-width: 450px; box-shadow: 0 10px 40px rgba(255, 204, 0, 0.3); animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
#custom-dialog h2 { color: #ffcc00; margin-top: 0; margin-bottom: 20px; text-shadow: 3px 3px 0 #000; font-size: 20px; }
#custom-dialog p { margin-bottom: 30px; font-family: Arial, sans-serif; font-size: 16px; line-height: 1.6; color: #ddd; }
#custom-dialog button { padding: 15px 30px; font-size: 14px; cursor: pointer; border: 4px solid #fff; border-radius: 8px; font-weight: bold; background: #3b4cca; color: white; transition: all 0.2s; box-shadow: 0 5px 0 #202b75; text-transform: uppercase; }
#custom-dialog button:hover { transform: translateY(-3px); box-shadow: 0 8px 0 #202b75; background: #4b5cdb; }
#custom-dialog button:active { transform: translateY(2px); box-shadow: 0 0px 0 #202b75; }

/* ANIMACIONES KEYFRAMES */
@keyframes popIn { 0% { transform: scale(0.5); opacity: 0; } 70% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }
@keyframes float { 0% { transform: translateY(0px); } 50% { transform: translateY(-8px); } 100% { transform: translateY(0px); } }
@keyframes pulse { 0% { opacity: 0.6; transform: scale(1); } 50% { opacity: 1; transform: scale(1.05); } 100% { opacity: 0.6; transform: scale(1); } }
@keyframes pulse-anim { 0% { transform: scale(1); } 50% { transform: scale(1.1); text-shadow: 3px 3px 0px #fff, 6px 6px 15px #ff5555; } 100% { transform: scale(1); } }
@keyframes drawCross { to { stroke-dashoffset: 0; } }
@keyframes eliminationCardShake { 0% { transform: scale(1) rotate(0deg); } 25% { transform: scale(0.95) rotate(-5deg); } 50% { transform: scale(0.95) rotate(5deg); } 75% { transform: scale(0.92) rotate(-5deg); } 100% { transform: scale(0.92) rotate(0deg); } }
@keyframes boardShake { 0% { transform: translate(1px, 1px) rotate(0deg); } 10% { transform: translate(-1px, -2px) rotate(-1deg); } 20% { transform: translate(-3px, 0px) rotate(1deg); } 30% { transform: translate(3px, 2px) rotate(0deg); } 40% { transform: translate(1px, -1px) rotate(1deg); } 50% { transform: translate(-1px, 2px) rotate(-1deg); } 60% { transform: translate(-3px, 1px) rotate(0deg); } 70% { transform: translate(3px, 1px) rotate(-1deg); } 80% { transform: translate(-1px, -1px) rotate(1deg); } 90% { transform: translate(1px, 2px) rotate(0deg); } 100% { transform: translate(0, 0) rotate(0deg); } }

/* ANIMACIONES TOASTS */
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOutToast { from { opacity: 1; } to { opacity: 0; transform: translateY(-10px); } }

/* ANIMACIONES SPLASH VS */
@keyframes slashAnim { 0% { transform: rotate(-15deg) scaleY(0); } 40% { transform: rotate(-15deg) scaleY(1); background: #fff; box-shadow: 0 0 100px #fff; } 100% { transform: rotate(-15deg) scaleY(20); opacity: 0; } }
@keyframes vsTextAnim { 0% { transform: scale(0) skewX(-15deg); opacity: 0; } 50% { transform: scale(1.2) skewX(-15deg); opacity: 1; } 100% { transform: scale(1) skewX(-15deg); opacity: 0; } }

/* RESPONSIVE */
@media (max-width: 1000px) {
    .boards-container { flex-direction: column; padding: 10px; }
    .center-targets { flex-direction: row; margin: 15px 0; gap: 30px; }
    .grid-5x5 { gap: 4px; padding: 6px; }
    .secret-hidden, .secret-revealed { width: 70px; height: 70px; }
    .vs-logo { font-size: 24px; }
}