   /* Estilos CSS embebidos */
        html, body { /* Aseguramos que html y body ocupen toda la altura */
            height: 100%;
            margin: 0;
            padding: 0;
        }
        body { 
            font-family: 'Inter', sans-serif; /* Usamos Inter */
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100%;
            width: 100%;
            margin: 0;
            background-color: #111111; /* Fondo oscuro para elegancia */
            color: #ffffff; /* Texto blanco puro */
            overflow: hidden; /* Evita scroll si el contenido es mayor */
        }

        /* Estilos para las pantallas generales */
        .game-screen {
            display: none; /* Ocultar todas las pantallas por defecto */
            flex-direction: column;
            align-items: center;
            padding: 25px; /* Espacioso */
            background-color: #111111; /* Fondo oscuro */
            border-radius: 10px; /* Bordes redondeados */
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
            width: 90%;
            max-width: 60%;
            box-sizing: border-box;
            gap: 20px; /* Separación interna */
        }
        .game-screen.active {
            display: flex; /* Mostrar solo la pantalla activa */
        }

        h1 {
            color: #ffffff;
            margin-bottom: 25px;
            text-align: center;
            font-size: 2.4em;
            text-transform: uppercase;
            letter-spacing: 2px;
        }

        .input-group {
            margin-bottom: 20px;
            width: 100%;
            text-align: center;
        }
        label {
            display: block;
            margin-bottom: 10px;
            font-size: 1.15em;
            color: #cccccc; /* Gris suave */
        }
        input[type="text"] {
            padding: 15px;
            width: calc(100% - 30px);
            border: 1px solid #555555;
            border-radius: 8px; /* Bordes redondeados */
            background-color: #333333;
            color: #ffffff;
            font-size: 1.1em;
            margin-bottom: 15px;
            box-sizing: border-box;
        }
        button {
            padding: 14px 30px;
            background-color: #FF0000; /* Rojo */
            color: #ffffff;
            border: none;
            border-radius: 5px; /* Bordes redondeados */
            cursor: pointer;
            font-size: 1.1em;
            font-weight: bold;
            text-transform: uppercase;
            letter-spacing: 1px;
            transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
            box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
        }
        button:hover {
            background-color: #CC0000; /* Rojo más oscuro */
            box-shadow: 0 5px 12px rgba(0, 0, 0, 0.5);
        }
        button:active {
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
        }

        /* Error message */
        .error-message {
            color: #ff4d4d;
            margin-top: 10px;
            font-weight: bold;
            text-align: center;
            font-size: 1em;
        }

        /* Estilos para la pantalla de fin de partida (screen2) */
        #screen2 {
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
            padding: 30px;
            gap: 25px;
            position: relative;
        }
        #screen2 h1 {
            font-size: 2.5em;
            color: #FFD700; /* Dorado */
            margin-bottom: 10px;
        }
        #screen2 p {
            font-size: 1.3em;
            color: #ffffff;
            margin-bottom: 5px;
        }
        #screen2 .player-names-display {
            font-size: 1.1em;
            color: #cccccc;
            margin-bottom: 20px;
        }
        #btnRematch {
            padding: 18px 40px;
            font-size: 1.3em;
            background-color: #FF0000;
            border-radius: 5px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
            transition: background-color 0.3s ease, transform 0.2s ease;
        }
        #btnRematch.ready {
            background-color: #28a745; /* Verde */
        }
        #btnRematch:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
        }
        #btnRematchStatusIndicator {
            position: absolute;
            bottom: 20px;
            left: 20px;
            width: 30px;
            height: 30px;
            border-radius: 50%;
            background-color: #dc3545;
            border: 2px solid #ffffff;
            cursor: pointer;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
            transition: background-color 0.3s ease;
        }
        #btnRematchStatusIndicator.active {
            background-color: #28a745;
        }

        /* Estilos para la pantalla de juego (screen3) */
        #screen3 {
            width: 100%;
            max-width: 60%;
            height: 100%;    
            grid-template-rows: auto auto auto;
            gap: 10px; 
            /* padding: 15px; */
            padding: 10px 10px 0 10px; /* Eliminado padding inferior para que la mano quede al borde */
            background-color: #1a1a1a; /* Fondo oscuro */
            border: none;
            box-shadow: none;
            justify-content: center;
            align-content: center;
        }
        #screen3.active {
            display: grid; /* Usar grid para la distribución */
            grid-template-rows: auto min-content auto 1fr auto; /* Oponente, Central, Botón, Jugador, Mensaje */
            align-items: stretch; /* Estirar filas para ocupar altura */
        }

        .player-area {
            display: flex;
            align-items: center;
            padding: 15px;
            border: 1px solid #333333;
            border-radius: 8px;
            background-color: #2b2b2b;
            box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.2);
        }
        .opponent-area {
            order: 1;
            flex-direction: column;
            position: relative;
        }
        .own-area {
            order: 3;
            flex-direction: column;
            position: relative; 
            display: flex; /* Añadido para control de hijos flex */
            padding: 0; /* Eliminado padding para que la mano quede al borde */
            height: 100%; /* Para que ocupe el espacio 1fr del grid */
        }

        .game-central-layout {
            order: 2;
            display: flex;
            justify-content: space-around;
            align-items: center;
            width: 100%;
            padding: 10px;
            box-sizing: border-box;
        }

        .deck, .discard-pile {
            width: 140px;
            height: 200px;
            border: 1px solid #555555;
            background-color: #333333;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 1.2em;
            color: #cccccc;
            border-radius: 8px;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
            cursor: pointer;
            flex-shrink: 0;
        }

        .hand {
            display: flex;
            gap: 15px; /* Espacio entre cartas */
            /* min-height: 160px; */ /* Se ajustará por el contenido y el área del jugador */
            /* padding: 10px; */
            padding: 10px 10px 0 10px; /* Padding superior y lateral, sin padding inferior */
            border-radius: 8px;
            /* align-items: center; */ /* Cambiado para alinear cartas abajo */
            align-items: flex-end; /* Alinea las cartas en la parte inferior del contenedor de la mano */
            justify-content: center; /* Centra las cartas horizontalmente */
            flex-wrap: wrap; /* Permite que las cartas pasen a la siguiente línea si no caben */
        }

        .own-hand {
            width: 100%;
            min-height: calc(280px + 10px); /* Altura de la carta + padding superior de la mano */
            justify-content: center;
            flex-wrap: wrap;
        }

        .opponent-hand .card-back {
            background-color: #000000;
            color: #ffffff;
            width: 120px;
            height: 160px;
            border-radius: 8px;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 2.5em;
            font-weight: bold;
            border: 1px solid #444444;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
        }

        .card-in-hand {
            width: 180px;  /* Aumentado */
            height: 280px; /* Aumentado */
            background-color: #ffffff;
            border: 1px solid #333333;
            border-radius: 8px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
            display: flex;
            flex-direction: column;
            overflow: hidden; /* Mantenemos esto para el diseño de la carta */
            cursor: pointer;
            transition: transform 0.3s ease, box-shadow 0.3s ease, z-index 0s 0.3s;
            position: relative;
            z-index: 1;
        }
        .card-in-hand:hover {
            transform: translateY(-20px) scale(1.15); /* Ajustado para cartas más grandes */
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
            z-index: 20;
        }

        .card-image {
            width: 100%;
            padding-top: 100%;
            position: relative;
            background-color: #f0f0f0;
            overflow: hidden;
            border-bottom: 1px solid #e0e0e0;
        }
        .card-image img {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .card-info {
            padding: 8px;
            font-size: 1.1em;
            color: #333333;
            display: flex;
            flex-direction: column;
            flex-grow: 1;
            justify-content: space-between;
        }
        .card-name-value {
            font-weight: bold;
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 6px;
            font-size: 0.95em;
        }
        .card-effect {
            font-size: 0.75em;
            line-height: 1.3;
            color: #555555;
        }

        .last-played-card {
            width: 170px;
            height: 260px;
            background-color: #ffffff;
            border: 1px solid #333333;
            border-radius: 8px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        #ownNameDisplay, #opponentNameDisplay {
            font-size: 1.5em;
            font-weight: bold;
            color: #ffffff;
            margin-bottom: 5px;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .active-effects-container {
            position: absolute;
            top: 10px;
            right: 10px;
            display: flex;
            flex-direction: column;
            gap: 5px;
            align-items: flex-end;
            z-index: 50;
        }
        .active-effect-card {
            display: flex;
            align-items: center;
            background-color: rgba(0, 0, 0, 0.7);
            border: 1px solid #FFD700;
            border-radius: 5px;
            padding: 5px 10px;
            color: #FFD700;
            font-size: 0.9em;
            gap: 10px;
        }
        .active-effect-card .card-image-small {
            width: 40px;
            height: 40px;
            border-radius: 3px;
            background-size: cover;
            background-position: center;
            border: 1px solid #FFD700;
        }

        .game-button {
            background-color: #FF0000;
            color: #ffffff;
            padding: 12px 30px;
            font-size: 1em;
            border: none;
            border-radius: 5px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
            cursor: pointer;
            margin-top: 15px;
            transition: background-color 0.3s ease;
        }
        .game-button:hover {
            background-color: #CC0000;
        }
        /* Estilo para el botón Pasar Turno en su nueva posición */
        #screen3 > #btnPassTurn {
            justify-self: center; /* Centrar horizontalmente en la celda del grid */
            align-self: center;   /* Centrar verticalmente en la celda del grid */
            margin-top: 10px;     /* Espacio desde el área del tablero */
            margin-bottom: 10px;  /* Espacio hacia el área de la mano del jugador */
        }

        .game-message {
            text-align: center;
            font-size: 1.3em;
            font-weight: bold;
            margin-top: 20px;
            color: #FFD700;
            text-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
        }

        .board-area {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background-color: #1a1a1a;
            border: 1px solid #FF0000;
            border-radius: 8px;
            position: relative;
            width: 100%;
            max-width: 900px;
            height: 80px;
            margin: auto;
            box-shadow: 0 0 10px rgba(255, 0, 0, 0.3);
            padding: 0 10px;
            flex-grow: 1;
        }

        .board-cell {
            width: 55px;
            height: 55px;
            background-color: #333333;
            border: 1px solid #555555;
            border-radius: 8px;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 1.1em;
            font-weight: bold;
            color: #ffffff;
            box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.3);
            position: relative;
        }

        .player-token {
            position: absolute;
            width: 35px;
            height: 35px;
            border-radius: 8px;
            border: 2px solid #ffffff;
            box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
            z-index: 10;
            top: 50%;
            transform: translateY(-50%);
        }
        .player1-token {
            background-color: #e74c3c;
            left: 5px;
        }
        .player2-token {
            background-color: #3498db;
            right: 5px;
        }

        .card-options {
            position: absolute;
            background-color: #2b2b2b;
            border: 1px solid #FF0000;
            border-radius: 8px;
            padding: 12px;
            z-index: 100;
            display: flex;
            flex-direction: column;
            gap: 8px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
        }
        .card-options button {
            width: 100%;
            padding: 10px 18px;
            font-size: 1em;
            background-color: #FF0000;
            color: #ffffff;
            text-transform: uppercase;
        }

        .modal-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(5px);
            z-index: 1000;
            justify-content: center;
            align-items: center;
        }
        .modal-content {
            background-color: #222222;
            border: 1px solid #FF0000;
            border-radius: 8px;
            padding: 30px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.6);
            text-align: center;
            max-width: 90%;
            width: 600px;
            box-sizing: border-box;
            display: flex;
            flex-direction: column;
            gap: 20px;
        }
        .modal-content.discard-modal-content {
            border: 2px solid #800080;
            outline: 2px solid white;
            outline-offset: -4px;
        }
        /* New styles for comparison and view hand modals */
        .modal-content.comparison-modal, .modal-content.view-hand-modal {
            border: 2px solid #00BFFF; /* A nice blue border */
            outline: 2px solid #ffffff;
            outline-offset: -4px;
        }

        .modal-content h2 {
            color: #FF0000;
            margin-bottom: 15px;
            font-size: 1.8em;
        }
        .modal-body {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 15px;
            margin-bottom: 20px;
            max-height: 400px;
            overflow-y: auto;
            padding-right: 10px;
        }
        .modal-body .card-in-hand {
            width: 120px;
            height: 170px;
            cursor: default;
            transform: none;
            box-shadow: 0 2px 8px rgba(0,0,0,0.3);
        }
        .modal-body .card-in-hand.selectable {
            cursor: pointer;
            transition: border 0.2s ease, box-shadow 0.2s ease;
        }
        .modal-body .card-in-hand.selectable:hover {
            transform: translateY(-5px) scale(1.05);
            box-shadow: 0 5px 15px rgba(0,0,0,0.4);
        }
        .modal-body .card-in-hand.selected {
            border: 3px solid white;
            box-shadow: 0 0 15px white;
        }
        .modal-buttons {
            display: flex;
            justify-content: center;
            gap: 20px;
        }
        .modal-buttons button {
            padding: 12px 25px;
            font-size: 1em;
            background-color: #FF0000;
            color: #ffffff;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            transition: background-color 0.3s ease;
        }
        .modal-buttons button:hover {
            background-color: #CC0000;
        }

        /* Media Queries para responsividad */
        @media (max-width: 768px) {
            .game-screen {
                padding: 15px;
                max-width: 95%;
            }
            h1 {
                font-size: 1.6em;
                margin-bottom: 15px;
            }
            label {
                font-size: 1em;
            }
            input[type="text"], button {
                padding: 10px;
                font-size: 0.9em;
            }
            #screen3 {
                grid-template-rows: auto 1fr auto;
                height: auto;
                min-height: 90vh; /* Asegurar que ocupe la mayor parte de la pantalla */
                padding: 10px;
                gap: 10px;
                padding-bottom: 0; /* Para que la mano quede al borde en móvil también */
            }
            .player-area, .game-central-layout {
                flex-direction: column;
                gap: 8px;
                padding: 8px;
            }
            .card-in-hand, .last-played-card, .opponent-hand .card-back {
                width: 115px;
                height: 180px;
            }
            .deck, .discard-pile {
                width: 100px;
                height: 140px;
            }
            .own-hand { /* Ajustes específicos para la mano del jugador en móvil */
                min-height: calc(180px + 10px); /* Altura de carta móvil + padding */
                padding: 5px 5px 0 5px; /* Menos padding en móvil */
            }
            .card-image {
                height: 50%;
            }
            .card-info {
                padding: 6px;
                font-size: 0.7em;
            }
            .card-name-value {
                font-size: 0.9em;
                margin-bottom: 4px;
            }
            .card-effect {
                font-size: 0.65em;
                line-height: 1.3;
            }
            .board-cell {
                width: 40px;
                height: 40px;
                font-size: 0.8em;
            }
            .player-token {
                width: 28px;
                height: 28px;
            }
            #ownNameDisplay, #opponentNameDisplay {
                font-size: 1.2em;
                margin-bottom: 8px;
            }
            .game-button {
                padding: 10px 20px;
            }
            .game-message {
                font-size: 1em;
                margin-top: 15px;
            }
            .card-options {
                padding: 8px;
                gap: 5px;
            }
            .card-options button {
                padding: 8px 12px;
                font-size: 0.85em;
            }
            .modal-content {
                padding: 20px;
                width: 95%;
            }
            .modal-content h2 {
                font-size: 1.5em;
            }
            .modal-body {
                gap: 10px;
            }
            .modal-body .card-in-hand {
                width: 90px;
                height: 120px;
            }
            .modal-buttons {
                flex-direction: column;
                gap: 10px;
            }
            .modal-buttons button {
                padding: 10px 20px;
                font-size: 0.9em;
            }
            .active-effect-card {
                font-size: 0.8em;
                padding: 3px 8px;
            }
            .active-effect-card .card-image-small {
                width: 30px;
                height: 30px;
            }
        }
