* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #e2e8f0;
    color: #2d3748;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    transition: background-color 0.6s ease, color 0.6s ease;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

#particles-js {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
}

button {
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: none;
    background-color: #4299e1;
    color: white;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.hidden {
    display: none !important;
}

.fade-out {
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

.fade-in {
    opacity: 1;
    transition: opacity 0.6s ease-in;
}

#introPantalla {
    opacity: 0;
    animation: fadeIn 1s forwards;
    background: linear-gradient(135deg, #667eea, #764ba2);
}

#introPantalla h1 {
    color: #ffffff;
    text-shadow: 3px 3px 10px rgba(0,0,0,0.9), 0 0 30px rgba(0,0,0,0.8);
}

#introPantalla p {
    color: #ffffff;
    font-weight: 600;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.9), 0 0 20px rgba(0,0,0,0.7);
}

#introPantalla button {
    background-color: rgba(255, 255, 255, 0.95);
    color: #2d3748;
    font-weight: 700;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

#introPantalla button:hover {
    background-color: #000000;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fade-in-up 0.8s ease-out forwards;
}

.animate-fade-in-up.delay-500 {
    animation-delay: 0.5s;
}

.animate-fade-in-up.delay-1000 {
    animation-delay: 1s;
}

.background-video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: 180vh;
    transform: translateX(-50%) translateY(-50%);
    z-index: 0;
    object-fit: cover;
}

.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    opacity: 0;
    animation: scaleIn 0.8s forwards ease-out;
    padding: 20px 0;
}

#startContent {
    position: relative;
    z-index: 1;
    background: none;
    padding: 40px;
    text-align: center;
    width: 100%;
    max-width: 1200px;
    color: white;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

#startContent.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.start-content h3, .start-content p {
    color: #000000;
}

.start-title {
    font-family: 'Poppins', sans-serif;
    font-size: 3.5rem;
    font-weight: 700;
    color: #000000;
    margin-bottom: 10px;
    text-shadow: 3px 3px 10px rgba(0,0,0,0.9);
}

.start-subtitle {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    font-weight: 500;
    color: #000000;
    margin-bottom: 20px;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.9);
}

#startContent .start-title {
    color: #000000;
    text-shadow: 3px 3px 10px rgba(0,0,0,0.9);
}

#startContent .start-subtitle, 
#startContent > p {
    color: #000000;
    font-weight: 500;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.9);
}

.player-selector {
    margin-top: 30px;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 25px;
    border-radius: 15px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.player-selector h3 {
    color: #ffffff;
    text-shadow: 2px 2px 6px rgba(0,0,0,0.8);
}

.player-input {
    width: 80%;
    padding: 12px;
    border: 2px solid #a0aec0;
    border-radius: 8px;
    font-size: 1.1rem;
    text-align: center;
    margin-top: 10px;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    color: #2d3748;
    background-color: #ffffff;
}

.player-input::placeholder {
    color: #9ca3af;
    opacity: 1;
}

.player-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.4);
}

.character-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 15px;
    margin-top: 20px;
    padding: 10px;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

/* Estilos para el scrollbar */
.character-selector-grid::-webkit-scrollbar {
    width: 8px;
}

.character-selector-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.character-selector-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.character-selector-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.character-option {
    font-size: 2.5rem;
    cursor: pointer;
    padding: 10px;
    border-radius: 10px;
    background-color: #edf2f7;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.character-option:hover {
    background-color: #e2e8f0;
    transform: scale(1.05);
}

.character-option.selected {
    border: 3px solid #667eea;
    background-color: #dbeafe;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.start-button {
    background-color: #667eea;
    color: white;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 15px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 180px;
}

.start-button:hover {
    background-color: #5a67d8;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
}

.start-button span {
    position: relative;
    z-index: 1;
}

.btn-path-study {
    background: linear-gradient(45deg, #60a5fa, #3b82f6);
}

.btn-path-work {
    background: linear-gradient(45deg, #f59e0b, #d97706);
}

.btn-path-leisure {
    background: linear-gradient(45deg, #4ade80, #22c55e);
}
.btn-path-combined {
    background: linear-gradient(45deg, #a78bfa, #7c3aed);
    position: relative;
    overflow: hidden;
}

.btn-path-combined::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
    transform: rotate(45deg);
    transition: all 0.6s;
    opacity: 0;
}

.btn-path-combined:hover::before {
    animation: shine 0.6s ease-in-out;
}

@keyframes shine {
    0% { transform: translateX(-100%) translateY(-100%); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateX(100%) translateY(100%); opacity: 0; }
}

.path-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}


.path-selection h3 {
    color: #ffffff;
    font-size: 1rem;
    margin: 1.5rem 0 1rem 0;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.9);
    font-weight: 600;
    letter-spacing: 2px;
    text-align: center;
    width: 100%;
}

.path-buttons-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    width: 100%;
    max-width: 800px;
}

.start-button.selected-path {
    border: 4px solid #facc15;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(250, 204, 21, 0.6);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.instructions-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 40;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    backdrop-filter: blur(5px);
}

.instructions-content {
    background-color: rgba(45, 55, 72, 0.9);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 30px 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.instructions-content h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 10px;
}

.instructions-content .subtitle {
    font-size: 1.1rem;
    color: #a0aec0;
    margin-bottom: 30px;
}

.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    text-align: left;
}

.instruction-item {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
}

.instruction-item h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #90cdf4;
    margin-bottom: 10px;
}

.instructions-content h4 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 20px;
}

.instructions-content ul {
    list-style: none;
    padding: 0;
    margin: 0 auto 30px auto;
    max-width: 500px;
    text-align: left;
}

.instructions-content ul li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.instructions-content ul li:last-child {
    border-bottom: none;
}

.game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    background-color: #f7fafc;
    overflow-y: auto;
    overflow-x: auto;
    box-sizing: border-box;
}

.game-title {
    font-family: 'Poppins', sans-serif;
    color: #4c51bf;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    font-size: 2rem;
    margin-bottom: 5px;
}

.game-subtitle {
    font-family: 'Poppins', sans-serif;
    color: #667eea;
    font-size: 1rem;
    margin-bottom: 5px;
}

header {
    text-align: center;
    margin-bottom: 10px;
}

progress {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    border: none !important;
    background-color: #e2e8f0 !important;
    border-radius: 10px !important;
    height: 20px !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    width: 100% !important;
    max-width: 1150px !important;
    margin: 0 auto 20px auto !important;
    display: block !important;
}

#progressBar {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    border: none !important;
    background-color: #e2e8f0 !important;
    border-radius: 10px !important;
    height: 20px !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    width: 100% !important;
    max-width: 1150px !important;
    margin: 0 auto 20px auto !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.game-layout {
    display: flex;
    gap: 1rem;
    width: 100%;
    height: auto;
    max-width: 1600px;
    margin: 0 auto;
    padding: 10px 50px 10px 10px;
    box-sizing: border-box;
}

.game-main-column {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.game-sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-shrink: 0;
}

.game-dashboard {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
    align-items: flex-start;
    margin-bottom: 20px;
    justify-content: center;
}

.stats-panel {
    background-color: #ffffff;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    flex-grow: 1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.stat-item {
    background-color: #edf2f7;
    border-radius: 8px;
    padding: 8px 10px;
    text-align: center;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: background-color 0.3s ease;
}

.stat-item .stat-label {
    font-size: 0.75rem;
    color: #4a5568;
    margin-bottom: 2px;
    font-weight: 600;
}

.stat-item .stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2d3748;
    position: relative;
}

.stat-item.stat-danger {
    background-color: #fee2e2;
    border: 1px solid #ef4444;
}

.stat-item.stat-warning {
    background-color: #fffbeb;
    border: 1px solid #f59e0b;
}

.stat-item.stat-good {
    background-color: #dcfce7;
    border: 1px solid #22c55e;
}

.stat-change-anim {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    font-weight: bold;
    opacity: 0;
    animation: statChange 1s forwards;
}

.stat-change-anim.positive {
    color: #22c55e;
}

.stat-change-anim.negative {
    color: #ef4444;
}

@keyframes statChange {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -100%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -150%) scale(0.7);
    }
}

#playerAvatar {
    font-size: 3rem;
    margin-bottom: 5px;
}

#logrosContainer {
    min-height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

#logrosContainer div {
    margin: 0 5px;
    cursor: help;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: #ffffff;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    min-width: 200px;
}

.btn-new-game {
    background-color: #ef4444;
    color: white;
    font-size: 1.1rem;
    padding: 10px 20px;
    border-radius: 10px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.btn-new-game:hover {
    background-color: #dc2626;
}

.dice-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    padding: 20px;
    border-radius: 15px;
    width: fit-content;
    position: fixed !important;
    bottom: 50px !important;
    right: 50px !important;
    cursor: grab !important;
    z-index: 1000 !important;
    user-select: none;
    pointer-events: auto !important;
}

.dice-container:active {
    cursor: grabbing !important;
}

.dice3d {
    position: relative;
    width: 80px;
    height: 80px;
    transform-style: preserve-3d;
    transition: transform 1.5s cubic-bezier(0.2, 0.8, 0.2, 1.2);
    transform: rotateX(-20deg) rotateY(20deg);
    cursor: pointer !important;
    pointer-events: auto !important;
}

.dice3d.rolling {
    animation: diceTumble 1.5s forwards;
}

@keyframes diceTumble {
    0% { transform: rotateX(-20deg) rotateY(20deg) scale(1); }
    25% { transform: rotateX(160deg) rotateY(110deg) scale(1.1); }
    50% { transform: rotateX(340deg) rotateY(200deg) scale(1.2); }
    75% { transform: rotateX(520deg) rotateY(290deg) scale(1.1); }
    100% { transform: rotateX(720deg) rotateY(720deg) scale(1); }
}

.dice3d .face {
    position: absolute;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border: 2px solid #92400e;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    font-weight: bold;
    color: #7c2d12;
    box-shadow: 
        inset 0 0 10px rgba(0,0,0,0.2),
        0 4px 8px rgba(0,0,0,0.3);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    backface-visibility: visible;
    opacity: 1;
}

.dice3d .one { transform: rotateY(0deg) translateZ(40px); }
.dice3d .two { transform: rotateY(90deg) translateZ(40px); }
.dice3d .three { transform: rotateY(180deg) translateZ(40px); }
.dice3d .four { transform: rotateY(-90deg) translateZ(40px); }
.dice3d .five { transform: rotateX(90deg) translateZ(40px); }
.dice3d .six { transform: rotateX(-90deg) translateZ(40px); }

#movementPointsDisplay {
    background-color: #dbeafe;
    padding: 8px 15px;
    border-radius: 8px;
    border: 1px solid #93c5fd;
    color: #1e40af;
    font-weight: 700;
    margin-top: 15px;
}

.game-board-main {
    display: grid;
    grid-template-columns: repeat(25, 1fr);
    grid-template-rows: repeat(10, 1fr);
    width: 1150px !important;
    height: 600px !important;
    background-color: #a0aec0;
    border: 4px solid #4a5568;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    transition: transform 0.5s ease-out;
    gap: 1px;
}

.game-board-main.zoomed {
    transform: scale(1.02);
}

.grid-square {
    width: 100%;
    height: 100%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.7);
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.1s ease;
    position: relative;
    overflow: hidden;
}

.grid-square.square-hidden {
    background-color: #2d3748; 
    border-color: #4a5568;
    transition: background-color 0.5s ease, border-color 0.5s ease;
}

.grid-square.path-study { background-color: #bfdbfe; }
.grid-square.path-work { background-color: #fef3c7; }
.grid-square.path-leisure { background-color: #dcfce7; }
.grid-square.path-normal { background-color: #e0e7ff; }

.grid-square.type-start { background-color: #a7f3d0; }
.grid-square.type-end { background-color: #fecaca; }
.grid-square.type-trivia { background-color: #fde68a; }
.grid-square.type-card_event { background-color: #c7d2fe; }
.grid-square.type-pension { background-color: #a78bfa; }
.grid-square.type-study { background-color: #dbeafe; }
.grid-square.type-work { background-color: #fef9c3; }
.grid-square.type-leisure { background-color: #dcfce7; }

.theme-dark .grid-square.type-study { background-color: #3b82f6; }
.theme-dark .grid-square.type-work { background-color: #eab308; }
.theme-dark .grid-square.type-leisure { background-color: #22c55e; }

.player-token {
    position: absolute;
    font-size: 2.5rem;
    z-index: 20;
    transition: left 0.3s ease-out, top 0.3s ease-out;
    transform: translate(-50%, -50%);
    animation: mapBounce 1s infinite;
    pointer-events: none;
}

@keyframes mapBounce {
    0%, 100% { transform: translate(-50%, -50%) translateY(0); }
    50% { transform: translate(-50%, -50%) translateY(-10px); }
}

.player-token.token-land-effect {
    animation: tokenLand 0.2s ease-out;
}

@keyframes tokenLand {
    0% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

.grid-square.reachable-square {
    background-color: #90cdf4;
    border: 2px solid #2b6cb0;
    cursor: pointer;
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.5);
}

.grid-square.reachable-square:hover {
    background-color: #63b3ed;
    transform: scale(1.1);
}

.grid-square.current-position {
    background-color: #fbd38d;
    border: 2px solid #dd6b20;
    box-shadow: 0 0 15px rgba(237, 137, 54, 0.7);
}

.grid-square.resaltado {
    animation: pulseHighlight 0.8s ease-out forwards;
}

@keyframes pulseHighlight {
    0% {
        box-shadow: 0 0 0px rgba(255, 255, 255, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 15px 5px rgba(255, 255, 255, 0.7);
        transform: scale(1.05);
    }
    100% {
        box-shadow: 0 0 0px rgba(255, 255, 255, 0);
        transform: scale(1);
    }
}

.path-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
    padding: 15px;
    background-color: #ffffff;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    font-size: 0.95rem;
    font-weight: 600;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    border-radius: 8px;
    color: #2d3748;
}

.study-legend { background-color: #bfdbfe; border: 1px solid #60a5fa; }
.work-legend { background-color: #fef3c7; border: 1px solid #f59e0b; }
.leisure-legend { background-color: #dcfce7; border: 1px solid #4ade80; }
.pension-legend { background-color: #a78bfa; border: 1px solid #8b5cf6; }

.message-log {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px;
    max-height: 200px;
    overflow-y: auto;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    padding: 15px;
    font-size: 0.9rem;
    line-height: 1.4;
    z-index: 100;
    display: flex;
    flex-direction: column-reverse;
    border: 1px solid #e2e8f0;
}

.message-log p {
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 1px dashed #edf2f7;
}

.message-log p:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.message-log-bottom {
    width: 100%;
    max-height: 150px;
    overflow-y: auto;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    font-size: 1rem;
    line-height: 1.6;
    margin-top: 20px;
    display: flex;
    flex-direction: column-reverse;
    border: 1px solid #e2e8f0;
}

.message-log-bottom p {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #cbd5e0;
    color: #2d3748;
}

.message-log-bottom p:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.overlay.show {
    opacity: 1;
    visibility: visible;
}

.message-box-custom {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background-color: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    text-align: center;
    max-width: 400px;
    width: 90%;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border: 2px solid #667eea;
}

.message-box-custom.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.message-box-custom h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #4c51bf;
    margin-bottom: 15px;
}

.message-box-custom p {
    font-size: 1.1rem;
    color: #4a5568;
    margin-bottom: 25px;
}

.message-box-custom .actions button {
    margin: 0 10px;
    padding: 10px 25px;
    font-size: 1rem;
    border-radius: 10px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

.message-box-custom .confirm-btn {
    background-color: #48bb78;
    color: white;
}

.message-box-custom .confirm-btn:hover {
    background-color: #38a169;
}

.message-box-custom .cancel-btn {
    background-color: #ef4444;
    color: white;
}

.message-box-custom .cancel-btn:hover {
    background-color: #dc2626;
}

.decision-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    max-width: 600px;
    width: 90%;
    border: 3px solid #667eea;
    animation: modalPopIn 0.4s ease-out forwards;
}

.decision-modal .decision-content {
    text-align: center;
    max-height: 80vh;
    overflow-y: auto;
}

.decision-modal .decision-title {
    font-family: 'Poppins', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: #4c51bf;
    margin-bottom: 20px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.decision-modal .decision-description {
    font-size: 1.1rem;
    color: #4a5568;
    margin-bottom: 30px;
    line-height: 1.6;
}

.decision-modal .decision-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.decision-option {
    background-color: #edf2f7;
    padding: 15px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border: 1px solid #cbd5e0;
    text-align: left;
}

.decision-option:hover {
    background-color: #e2e8f0;
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
    border-color: #667eea;
}

.decision-option .choice-effect {
    font-size: 0.9rem;
    color: #718096;
    margin-top: 5px;
    font-weight: 400;
}

.trivia-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    max-width: 90vw;
    width: 90%;
    max-height: 80vh; /* ✅ Máximo 80% de altura de pantalla */
    border: 3px solid #facc15;
    animation: modalPopIn 0.4s ease-out forwards;
    text-align: center;
    overflow-y: auto; /* ✅ Scroll vertical cuando sea necesario */
    box-sizing: border-box;
}

.trivia-modal .trivia-question {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 25px;
    line-height: 1.5;
}

.trivia-modal .trivia-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.trivia-option {
    background-color: #fffbeb;
    padding: 12px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #2d3748;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    border: 1px solid #fbd38d;
    text-align: left;
}

.trivia-option:hover {
    background-color: #fefcbf;
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    border-color: #facc15;
}

.trivia-option.correct {
    background-color: #dcfce7;
    border-color: #48bb78;
    color: #2d3748;
    font-weight: 700;
}

.trivia-option.incorrect {
    background-color: #fee2e2;
    border-color: #ef4444;
    color: #2d3748;
    font-weight: 700;
}

.trivia-result {
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 25px;
    padding: 10px;
    border-radius: 10px;
}

.trivia-result.correct {
    color: #059669;
    background-color: #a7f3d0;
}

.trivia-result.incorrect {
    color: #dc2626;
    background-color: #fecaca;
}

.trivia-continue-btn {
    margin-top: 20px;
    background-color: #4299e1;
    color: white;
    font-size: 1.1rem;
    padding: 10px 25px;
    border-radius: 10px;
}

.trivia-continue-btn:hover {
    background-color: #3182ce;
}

@keyframes modalPopIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

#trainingScreen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #1a202c, #2d3748);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 50;
    padding: 20px;
    animation: fadeIn 0.6s forwards;
}

#trainingContent {
    background-color: rgba(0, 0, 0, 0.4);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
}

#trainingScreen h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: #81e6d9;
    margin-bottom: 25px;
}

#trainingQuestion {
    font-size: 1.4rem;
    margin-bottom: 25px;
    line-height: 1.6;
}

.training-option {
    background-color: #4a5568;
    padding: 15px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid #718096;
}

.training-option:hover {
    background-color: #616e7f;
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

.training-option.correct {
    background-color: #48bb78;
    border-color: #2f855a;
    color: white;
    font-weight: 700;
}

.training-option.incorrect {
    background-color: #ef4444;
    border-color: #c53030;
    color: white;
    font-weight: 700;
}

#trainingResult {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 25px;
    padding: 10px;
    border-radius: 10px;
}

#trainingResult.correct {
    color: #a7f3d0;
}

#trainingResult.incorrect {
    color: #fecaca;
}

.training-button {
    background-color: #4299e1;
    color: white;
    margin-top: 25px;
    padding: 12px 25px;
    font-size: 1.1rem;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.training-button:hover {
    background-color: #3182ce;
}

.end-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #1a202c, #2d3748);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
    animation: fadeIn 0.6s forwards;
}

.end-screen-content {
    background-color: rgba(0, 0, 0, 0.4);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    margin: auto;
}

.end-screen h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    color: #48bb78;
    margin-bottom: 20px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

#finalSummary {
    font-size: 1.2rem;
    line-height: 1.8;
    color: #e2e8f0;
}

#timeline {
    max-height: 200px;
    overflow-y: auto;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    text-align: left;
    color: #cbd5e0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.effect-popup {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    white-space: nowrap;
    pointer-events: none;
    animation: fadeOutUp 1.5s forwards;
    z-index: 50;
    transform: translate(-50%, -50%);
}

.effect-popup.positive {
    color: #059669;
    border: 1px solid #a7f3d0;
}

.effect-popup.negative {
    color: #dc2626;
    border: 1px solid #fecaca;
}

@keyframes fadeOutUp {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(-50px);
    }
}

progress {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: none;
    background-color: #e2e8f0;
    border-radius: 10px;
    height: 10px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

progress::-webkit-progress-bar {
    background-color: #e2e8f0 !important;
    border-radius: 10px !important;
}

progress::-webkit-progress-value {
    background-color: #4c51bf !important;
    border-radius: 10px !important;
    transition: width 0.5s ease-in-out !important;
}

progress::-moz-progress-bar {
    background-color: #4c51bf !important;
    border-radius: 10px !important;
    transition: width 0.5s ease-in-out !important;
}

progress {
    color: #4c51bf !important;
}

body.theme-default {
    background: linear-gradient(135deg, #e0e7ff, #bfdbfe);
    color: #2d3748;
}

body.theme-dark {
    background: linear-gradient(135deg, #1a202c, #2d3748);
    color: #e2e8f0;
}

body.theme-urbano {
    background: linear-gradient(135deg, #a0aec0, #718096);
    color: #2d3748;
}

body.theme-rural {
    background: linear-gradient(135deg, #dcfce7, #a7f3d0);
    color: #2d3748;
}

body.theme-futurista {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #81e6d9;
}

/* Logos del juego principal */
.logo-oiss-main {
    position: fixed;
    top: 20px;
    right: 20px;
    height: 80px;
    width: auto;
    max-width: 320px;
    z-index: 1000;
    object-fit: contain;
}

.logo-aecid-main {
    position: fixed;
    bottom: 20px;
    left: 20px;
    height: 140px;
    width: auto;
    max-width: 500px;
    z-index: 1000;
    object-fit: contain;
}

@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
        width: 100%;
    }
    
    body {
        overflow-y: auto;
    }
    
    /* Logos más pequeños y abajo en móviles */
    .logo-oiss-main {
        position: fixed;
        bottom: 5px;
        right: 5px;
        top: auto;
        height: 35px;
        max-width: 120px;
        z-index: 1000;
    }
    
    .logo-aecid-main {
        position: fixed;
        bottom: 5px;
        left: 5px;
        top: auto;
        height: 45px;
        max-width: 150px;
        z-index: 1000;
    }
    
    .start-screen, .end-screen-content, #trainingContent {
        padding: 10px 5px;
        padding-bottom: 60px;
        width: 100%;
        max-width: 100%;
        margin: 0;
        box-sizing: border-box;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .game-container {
        padding: 10px 3px;
        padding-bottom: 60px;
        width: 100%;
        max-width: 100%;
        margin: 0;
        box-sizing: border-box;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .start-title {
        font-size: 2rem;
        margin-bottom: 10px;
    }

    .start-subtitle {
        font-size: 1rem;
    }

    .player-input {
        width: 90%;
        max-width: 100%;
    }

    .character-selector-grid {
        grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
        gap: 10px;
    }

    .start-button {
        font-size: 0.9rem;
        padding: 10px 16px;
        min-width: 120px;
    }
    
    /* Layout simple: todo en columna */
    .game-layout {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .game-sidebar {
        width: 100%;
        flex-direction: column;
        order: 1;
    }

    .game-main-column {
        width: 100%;
        order: 2;
    }

    .stats-panel {
        width: 100%;
        margin-bottom: 10px;
        padding: 12px 5px;
        background: rgba(255, 255, 255, 0.95);
        border-radius: 15px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    }

    .stats-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 4px;
        width: 100%;
    }

    .stat-item {
        padding: 8px 1px;
        background-color: #edf2f7;
        border-radius: 6px;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .stat-item .stat-value {
        font-size: 1.2rem;
        font-weight: bold;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .stat-item .stat-label {
        font-size: 0.58rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    #playerAvatar {
        font-size: 2rem;
    }

    .controls {
        width: 100%;
        margin-bottom: 10px;
        padding: 10px 5px;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        background: rgba(255, 255, 255, 0.95);
        border-radius: 15px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    }
    
    .controls button {
        font-size: 0.75rem;
        padding: 10px 6px;
        width: 100%;
        margin: 0;
    }

    .dice-container {
        width: 100%;
        display: flex;
        justify-content: center;
        margin-bottom: 15px;
        padding: 15px 10px;
        position: relative;
    }
    
    .dice3d {
        width: 80px;
        height: 80px;
        cursor: move;
        touch-action: none;
    }

    .game-board-main {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 450px !important;
        aspect-ratio: 2.5 / 1 !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        margin: 0 0 10px 0;
        -webkit-overflow-scrolling: touch;
    }

    .grid-square {
        font-size: 0.5rem;
        min-width: 42px;
        min-height: 42px;
    }

    .player-token {
        font-size: 1.6rem;
        width: 42px;
        height: 42px;
    }

    .message-log {
        width: 90%;
        right: 5%;
        left: 5%;
        bottom: 10px;
        max-height: 150px;
    }
    
    .message-log-bottom {
        width: 100%;
        max-height: 120px;
        padding: 12px 8px;
        font-size: 0.8rem;
        margin-top: 10px;
        background: rgba(255, 255, 255, 0.95);
        border-radius: 15px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
    }
    
    .path-legend {
        flex-wrap: wrap;
        gap: 5px;
        padding: 12px 8px;
        font-size: 0.75rem;
        width: 100%;
        background: rgba(255, 255, 255, 0.95);
        border-radius: 15px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        margin-bottom: 10px;
    }
    
    .legend-item {
        padding: 6px 8px;
        font-size: 0.68rem;
        flex: 1 1 auto;
        min-width: fit-content;
    }

    .message-box-custom, .decision-modal, .trivia-modal {
        width: 95%;
        max-width: 95%;
        padding: 20px;
        box-sizing: border-box;
    }

    .message-box-custom h3, .decision-modal .decision-title, .trivia-modal h3, #trainingScreen h2 {
        font-size: 1.3rem;
    }

    .message-box-custom p, .decision-modal .decision-description, .trivia-modal .trivia-question {
        font-size: 0.95rem;
    }

    .message-box-custom .actions button, .decision-option, .trivia-option, .training-button {
        font-size: 0.85rem;
        padding: 8px 12px;
    }
    
    .game-title {
        font-size: 1.6rem !important;
    }
    
    .game-subtitle {
        font-size: 0.9rem !important;
    }
    
    header.text-center {
        margin-bottom: 10px !important;
    }
    
    #progressBar {
        margin-bottom: 10px;
    }
}

.btn-path-nomad {
    background: linear-gradient(45deg, #f59e0b, #4ade80);
}

.btn-path-traveler {
    background: linear-gradient(45deg, #60a5fa, #4ade80);
}

.btn-path-entrepreneur {
    background: linear-gradient(45deg, #60a5fa, #f59e0b);
}

.btn-path-balanced {
    background: linear-gradient(45deg, #a78bfa, #7c3aed);
}

.btn-path-nomad:hover {
    background: linear-gradient(45deg, #d97706, #22c55e);
}

.btn-path-traveler:hover {
    background: linear-gradient(45deg, #3b82f6, #22c55e);
}

.btn-path-entrepreneur:hover {
    background: linear-gradient(45deg, #3b82f6, #d97706);
}

.btn-path-balanced:hover {
    background: linear-gradient(45deg, #8b5cf6, #6d28d9);
}

/* Nuevos tipos de casillas */
.grid-square.type-crisis { 
    background-color: #fecaca; 
    border-color: #ef4444;
}

.grid-square.type-opportunity { 
    background-color: #fed7aa; 
    border-color: #f97316;
}

.grid-square.type-investment { 
    background-color: #dbeafe; 
    border-color: #3b82f6;
}

/* Efectos especiales para casillas peligrosas */
.grid-square.type-crisis:hover {
    background-color: #fca5a5;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.grid-square.type-opportunity:hover {
    background-color: #fdba74;
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.5);
}

.grid-square.type-investment:hover {
    background-color: #93c5fd;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

/* Estilos para los nuevos botones de rutas combinadas */
.btn-path-nomad {
    background: linear-gradient(45deg, #f59e0b, #4ade80);
}

.btn-path-traveler {
    background: linear-gradient(45deg, #60a5fa, #4ade80);
}

.btn-path-entrepreneur {
    background: linear-gradient(45deg, #60a5fa, #f59e0b);
}

.btn-path-balanced {
    background: linear-gradient(45deg, #a78bfa, #7c3aed);
}

.btn-path-nomad:hover {
    background: linear-gradient(45deg, #d97706, #22c55e);
}

.btn-path-traveler:hover {
    background: linear-gradient(45deg, #3b82f6, #22c55e);
}

.btn-path-entrepreneur:hover {
    background: linear-gradient(45deg, #3b82f6, #d97706);
}

.btn-path-balanced:hover {
    background: linear-gradient(45deg, #8b5cf6, #6d28d9);
}

/* Estilos para el modal de inversiones */
.investment-option {
    background-color: #f0f9ff;
    padding: 15px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e40af;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border: 1px solid #bfdbfe;
    text-align: left;
    margin-bottom: 10px;
}

.investment-option:hover {
    background-color: #dbeafe;
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
    border-color: #3b82f6;
}

.investment-option h4 {
    margin-bottom: 5px;
    font-size: 1.2rem;
}

.investment-cost {
    font-size: 0.9rem;
    color: #374151;
    margin-top: 5px;
    font-weight: 400;
}


.effect-popup {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    white-space: nowrap;
    pointer-events: none;
    animation: fadeOutUp 1.5s forwards;
    z-index: 50;
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.effect-popup.positive {
    color: #059669;
    border: 2px solid #a7f3d0;
}

.effect-popup.negative {
    color: #dc2626;
    border: 2px solid #fecaca;
}

@keyframes fadeOutUp {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(-50px);
    }
}
/* Nuevos tipos de casillas */
.grid-square.type-crisis { 
    background-color: #fecaca; 
    border-color: #ef4444;
}

.grid-square.type-opportunity { 
    background-color: #fed7aa; 
    border-color: #f97316;
}

.grid-square.type-investment { 
    background-color: #dbeafe; 
    border-color: #3b82f6;
}

/* Efectos especiales para casillas peligrosas */
.grid-square.type-crisis:hover {
    background-color: #fca5a5;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}
/* Estilos actualizados para personajes con imágenes */
.character-option {
    font-size: 0; /* Quitar tamaño de fuente ya que ahora usamos imágenes */
    cursor: pointer;
    padding: 5px;
    border-radius: 10px;
    background-color: #edf2f7;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.character-option:hover {
    background-color: #e2e8f0;
    transform: scale(1.05);
}

.character-option.selected {
    border: 3px solid #667eea;
    background-color: #dbeafe;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.player-token {
    position: absolute;
    width: 40px;
    height: 40px;
    z-index: 20;
    transition: left 0.3s ease-out, top 0.3s ease-out;
    transform: translate(-50%, -50%);
    animation: mapBounce 1s infinite;
    pointer-events: none;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}


/* ========================================== */
/* MEJORAS ADICIONALES PARA MÓVILES PEQUEÑOS */
/* ========================================== */

@media (max-width: 480px) {
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
        width: 100%;
    }
    
    body {
        overflow-y: auto;
    }
    
    /* Logos aún más pequeños en móviles pequeños */
    .logo-oiss-main {
        bottom: 3px;
        right: 3px;
        height: 30px;
        max-width: 100px;
    }
    
    .logo-aecid-main {
        bottom: 3px;
        left: 3px;
        height: 40px;
        max-width: 130px;
    }
    
    .start-screen, .end-screen-content, #trainingContent {
        padding: 8px 3px;
        padding-bottom: 50px;
    }
    
    .game-container {
        padding: 8px 2px;
        padding-bottom: 50px;
    }
    
    .start-title {
        font-size: 1.5rem;
    }
    
    .start-subtitle {
        font-size: 0.85rem;
    }
    
    .start-button {
        font-size: 0.8rem;
        padding: 8px 12px;
        min-width: 100px;
    }

    .game-board-main {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 350px !important;
        font-size: 0.6rem;
    }
    
    .grid-square {
        font-size: 0.35rem;
        min-width: 28px;
        min-height: 28px;
        padding: 1px;
    }
    
    .player-token {
        font-size: 1.1rem;
        width: 30px;
        height: 30px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 3px;
    }
    
    .stat-item {
        padding: 6px 1px;
        overflow: hidden;
    }
    
    .stat-item .stat-value {
        font-size: 1.1rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .stat-item .stat-label {
        font-size: 0.55rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .dice3d {
        width: 60px;
        height: 60px;
    }
    
    .dice3d .face {
        font-size: 1.8rem;
    }
    
    .message-box-custom, .decision-modal, .trivia-modal {
        width: 98%;
        max-width: 98%;
        padding: 15px;
        max-height: 90vh;
        overflow-y: auto;
        box-sizing: border-box;
    }
    
    .message-box-custom h3, .decision-modal .decision-title, .trivia-modal h3 {
        font-size: 1.1rem;
    }
    
    .message-box-custom p, .decision-modal .decision-description, .trivia-modal .trivia-question {
        font-size: 0.85rem;
    }
    
    .decision-option, .trivia-option {
        font-size: 0.8rem;
        padding: 8px;
    }
    
    .game-title {
        font-size: 1.5rem !important;
    }
    
    .game-subtitle {
        font-size: 0.85rem !important;
    }
    
    .path-legend {
        gap: 5px;
        padding: 8px;
        font-size: 0.7rem;
    }
    
    .legend-item {
        padding: 4px 8px;
        font-size: 0.65rem;
    }
    
    .message-log-bottom {
        padding: 8px;
        font-size: 0.75rem;
        max-height: 100px;
    }
}

/* Permitir scroll horizontal en el tablero para móviles */
@media (max-width: 768px) {
    .game-board-container {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }
}
