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

        /* Modal Close Button */
        .modal-close {
            position: absolute;
            top: 12px;
            right: 12px;
            width: 32px;
            height: 32px;
            background: rgba(0, 0, 0, 0.3);
            border: none;
            border-radius: 6px;
            color: white;
            font-size: 1.8rem;
            font-weight: 300;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s ease;
            z-index: 1000;
            line-height: 1;
            opacity: 0.8;
            padding: 0;
        }

        .modal-close:hover {
            background: rgba(239, 68, 68, 0.9);
            opacity: 1;
            transform: scale(1.05);
        }

        .modal-close:active {
            transform: scale(0.95);
        }

        body {
            margin: 0;
            padding: 0;
            padding-top: env(safe-area-inset-top); /* Para el notch de iPhone */
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
            background: linear-gradient(180deg, #0a2540 0%, #1e3a5f 50%, #2c5282 100%);
            background-attachment: fixed; /* Mantener fondo fijo mientras se hace scroll */
            min-height: 100vh; /* Mínimo una pantalla completa */
            color: white;
            overflow-x: hidden;
            overflow-y: auto; /* Scroll nativo del body */
            box-sizing: border-box;
            width: 100%;
            -webkit-overflow-scrolling: touch; /* Smooth scrolling en iOS */
        }
        
        /* Fix para Safari iOS */
        html {
            height: auto;
            overflow-x: hidden;
            max-width: 100%;
            width: 100%;
            scroll-behavior: smooth; /* Scroll suave nativo */
        }
        
        /* Scrollbar personalizado para el body */
        body::-webkit-scrollbar {
            width: 10px;
        }
        
        body::-webkit-scrollbar-track {
            background: rgba(10, 37, 64, 0.8);
        }
        
        body::-webkit-scrollbar-thumb {
            background: linear-gradient(180deg, rgba(96, 165, 250, 0.6) 0%, rgba(6, 182, 212, 0.6) 100%);
            border-radius: 5px;
            border: 2px solid rgba(10, 37, 64, 0.8);
        }
        
        body::-webkit-scrollbar-thumb:hover {
            background: linear-gradient(180deg, rgba(96, 165, 250, 0.8) 0%, rgba(6, 182, 212, 0.8) 100%);
        }
        
        /* Fix adicional para iOS - prevenir scroll bounce */
        @supports (-webkit-touch-callout: none) {
            body {
                /* iOS Safari */
                height: -webkit-fill-available;
            }
            
            .game-wrapper {
                min-height: -webkit-fill-available;
            }
        }

        /* Navbar - asegurar que esté siempre encima de elementos del juego */
        .navbar {
            z-index: 2000 !important;
            position: sticky !important;
            top: 0 !important;
        }

        /* Dropdown del navbar - debe estar encima de todo */
        .navbar .dropdown-menu {
            z-index: 2010 !important;
        }

        /* Backdrop del dropdown si es necesario */
        .navbar .dropdown-menu.show {
            z-index: 2010 !important;
        }

        /* Bootstrap 5 Auth Modal - Por encima del navbar */
        #authModal {
            z-index: 2100 !important;
        }
        #authModal ~ .modal-backdrop {
            z-index: 2090 !important;
        }

        /* Bootstrap 5 Message Modal */
        #messageModal {
            z-index: 2050 !important;
        }
        #messageModal ~ .modal-backdrop {
            z-index: 2040 !important;
        }

        /* Modal Styles - Solo para modales personalizados del juego, NO Bootstrap */
        #messageModal.modal,
        #gameModal.modal {
            /* Estilos específicos para modales de Bootstrap del juego */
        }

        /* Scrollbar personalizado solo para modales del juego */
        #messageModal .modal-content::-webkit-scrollbar,
        #gameModal .modal-content::-webkit-scrollbar {
            width: 8px;
        }

        #messageModal .modal-content::-webkit-scrollbar-track,
        #gameModal .modal-content::-webkit-scrollbar-track {
            background: rgba(0, 0, 0, 0.2);
            border-radius: 10px;
        }

        #messageModal .modal-content::-webkit-scrollbar-thumb,
        #gameModal .modal-content::-webkit-scrollbar-thumb {
            background: #06b6d4;
            border-radius: 10px;
        }

        #messageModal .modal-content::-webkit-scrollbar-thumb:hover,
        #gameModal .modal-content::-webkit-scrollbar-thumb:hover {
            background: #60a5fa;
        }

        /* Dental Modal Theme */
        .dental-modal {
            background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%) !important;
            border: 2px solid rgba(96, 165, 250, 0.3) !important;
            box-shadow: 0 25px 70px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(96, 165, 250, 0.1) !important;
            border-radius: 1.5rem !important;
        }

        .dental-modal .modal-header {
            padding: 2rem 2rem 1rem !important;
        }

        .dental-modal .modal-body {
            padding: 0 2rem 2rem !important;
            color: rgba(255, 255, 255, 0.9);
        }

        .dental-modal .modal-footer {
            padding: 0 2rem 2rem !important;
        }

        .dental-modal-title {
            background: linear-gradient(135deg, #60a5fa 0%, #06b6d4 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            font-weight: 700 !important;
        }

        /* Close button */
        .dental-modal .btn-close {
            position: absolute;
            top: 1rem;
            right: 1rem;
            opacity: 0.8;
            padding: 0.5rem;
        }

        .dental-modal .btn-close:hover {
            opacity: 1;
            transform: rotate(90deg);
            transition: all 0.3s ease;
        }

        .dental-modal .btn-close:focus {
            box-shadow: none;
            outline: none;
        }

        /* Alert Styles */
        .dental-modal .alert {
            border-radius: 0.75rem;
            border: none;
            padding: 1rem;
            margin-bottom: 1rem;
        }

        .dental-modal .alert-success {
            background: rgba(22, 163, 74, 0.15);
            color: #4ade80;
            border-left: 4px solid #4ade80;
        }

        .dental-modal .alert-danger {
            background: rgba(220, 38, 38, 0.15);
            color: #f87171;
            border-left: 4px solid #f87171;
        }

        /* Estilos de botones personalizados del juego - NO afectar navbar */
        .game-wrapper .btn,
        .modal-content .btn:not(.btn-close),
        .dental-modal .btn:not(.btn-close),
        button.start-game-btn,
        button.action-btn {
            padding: 0.75rem 1.25rem;
            border: none;
            border-radius: 0.75rem;
            font-size: 0.95rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
            position: relative;
            overflow: hidden;
            white-space: nowrap;
        }

        .game-wrapper .btn::before,
        .modal-content .btn:not(.btn-close)::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 0;
            height: 0;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.1);
            transform: translate(-50%, -50%);
            transition: width 0.6s, height 0.6s;
        }

        .game-wrapper .btn:active::before,
        .modal-content .btn:not(.btn-close):active::before {
            width: 300px;
            height: 300px;
        }

        /* Dental Buttons */
        .dental-btn-primary {
            background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%) !important;
            border: none !important;
            color: white !important;
            font-weight: 600 !important;
            padding: 0.875rem 1.5rem !important;
            border-radius: 0.75rem !important;
            transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
            box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3) !important;
        }

        .dental-btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 16px rgba(6, 182, 212, 0.4) !important;
            background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%) !important;
        }

        /* Modal Backdrop */
        .modal-backdrop {
            background-color: rgba(0, 0, 0, 0.85) !important;
            backdrop-filter: blur(10px);
        }

        /* Bootstrap 5 Game Modal - Por encima del navbar */
        #gameModal {
            z-index: 2150 !important;
        }
        #gameModal ~ .modal-backdrop {
            z-index: 2140 !important;
        }
        #gameModal .modal-dialog {
            z-index: 2150 !important;
            margin: 1.75rem auto;
            max-width: 500px;
        }
        #gameModal .modal-content {
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
        }
        
        /* Scroll completo en pantallas de poca altura */
        @media (max-height: 700px) {
            #gameModal .modal-dialog {
                margin: 1rem auto;
            }
            #gameModal .modal-header {
                padding: 1rem !important;
                padding-bottom: 0.5rem !important;
            }
            #gameModal .modal-body {
                padding: 1rem !important;
                padding-top: 0.5rem !important;
            }
            #gameModal .modal-body p {
                font-size: 1rem !important;
                margin-bottom: 1rem !important;
            }
            #gameModal .modal-stats {
                gap: 0.75rem !important;
            }
            #gameModal .modal-stat {
                padding: 0.75rem !important;
            }
            #gameModal .modal-stat-label {
                font-size: 0.8rem !important;
            }
            #gameModal .modal-stat-value {
                font-size: 1.5rem !important;
            }
            #gameModal .modal-footer {
                padding: 1rem !important;
                padding-top: 0.75rem !important;
            }
            #gameModal .modal-footer button {
                font-size: 1rem !important;
                padding: 0.7rem !important;
            }
            #gameModalTitle {
                font-size: 1.6rem !important;
            }
        }

        @media (max-height: 600px) {
            #gameModal .modal-dialog {
                margin: 0.5rem auto;
            }
            #gameModal .modal-header {
                padding: 0.75rem !important;
                padding-bottom: 0.5rem !important;
            }
            #gameModal .modal-body {
                padding: 0.75rem !important;
                padding-top: 0.25rem !important;
            }
            #gameModal .modal-body p {
                font-size: 0.95rem !important;
                margin-bottom: 0.75rem !important;
            }
            #gameModal .modal-stats {
                gap: 0.5rem !important;
            }
            #gameModal .modal-stat {
                padding: 0.5rem !important;
            }
            #gameModal .modal-stat-label {
                font-size: 0.75rem !important;
                margin-bottom: 0.25rem !important;
            }
            #gameModal .modal-stat-value {
                font-size: 1.3rem !important;
            }
            #gameModal .modal-footer {
                padding: 0.75rem !important;
                padding-top: 0.5rem !important;
            }
            #gameModal .modal-footer button {
                font-size: 0.95rem !important;
                padding: 0.6rem !important;
            }
            #gameModalTitle {
                font-size: 1.4rem !important;
            }
        }
        
        *, *::before, *::after {
            box-sizing: border-box;
        }

        /* Fondo de consultorio difuminado */
        body::before {
            content: '';
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-image: 
                radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 50%, rgba(6, 182, 212, 0.1) 0%, transparent 50%);
            pointer-events: none;
            z-index: 0;
        }
        
        .header-games-logo {
            margin-bottom: 20px;
        }

        .logos-games {
            margin-top: 30px;
            max-width: 100%;
        }

        .game-wrapper {
            position: relative;
            max-width: min(600px, 100%);
            margin: 0 auto;
            padding: 15px;
            padding-top: 80px; /* Espacio para el navbar sticky */
            padding-bottom: 30px;
            z-index: 1;
            overflow-x: hidden;
            overflow-y: visible; /* Scroll nativo del body/window */
            box-sizing: border-box;
            width: 100%;
            min-height: auto; /* Altura automática basada en contenido */
        }

        /* Header con moves y progreso */
        .top-header {
            display: flex;
            align-items: center;
            gap: 15px;
            margin-bottom: 15px;
            background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
            padding: 12px 20px;
            border-radius: 15px;
            border: 3px solid rgba(96, 165, 250, 0.3);
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
            width: 100%;
            max-width: min(540px, 100%); /* Ancho limitado como el tablero */
            box-sizing: border-box;
        }


        .moves-badge {
            background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
            color: white;
            padding: 10px 18px;
            border-radius: 10px;
            font-weight: 800;
            font-size: 1rem;
            letter-spacing: 1px;
            box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
            border: 2px solid rgba(255, 255, 255, 0.3);
            flex-shrink: 0;
            text-align: center;
            min-width: 90px;
        }

        .moves-label {
            font-size: 0.7rem;
            opacity: 0.9;
            display: block;
            margin-bottom: 2px;
        }

        .moves-value {
            font-size: 1.4rem;
        }

        .progress-section {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .progress-bar-container {
            background: rgba(15, 23, 42, 0.6);
            height: 28px;
            border-radius: 50px;
            overflow: hidden;
            border: 2px solid rgba(96, 165, 250, 0.3);
            position: relative;
        }

        .progress-bar {
            height: 100%;
            background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
            border-radius: 50px;
            transition: width 0.5s ease;
            position: relative;
            box-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
        }

        .progress-bar::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 50%;
            background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, transparent 100%);
            border-radius: 50px 50px 0 0;
        }

        .objectives {
            display: flex;
            gap: 12px;
            align-items: center;
            flex-wrap: wrap;
            justify-content: center;
        }

        .objective-badge {
            background: rgba(15, 23, 42, 0.7);
            padding: 6px 14px;
            border-radius: 20px;
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 0.95rem;
            font-weight: 700;
            border: 2px solid rgba(96, 165, 250, 0.4);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        }

        .objective-icon {
            font-size: 1.3rem;
            filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
        }

        .objective-value {
            color: #fbbf24;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
        }
        
        #comboNext {
            display: inline-block;
            font-weight: 600;
            animation: pulse 2s ease-in-out infinite;
        }
        
        @keyframes pulse {
            0%, 100% { 
                opacity: 0.7;
                transform: scale(1);
            }
            50% { 
                opacity: 1;
                transform: scale(1.05);
            }
        }

        .level-badge-header {
            background: rgba(15, 23, 42, 0.7);
            padding: 6px 14px;
            border-radius: 20px;
            font-size: 0.85rem;
            font-weight: 700;
            border: 2px solid rgba(96, 165, 250, 0.4);
            color: #60a5fa;
        }

        /* Decoraciones del consultorio */
        .board-wrapper {
            position: relative;
            display: flex;
            justify-content: center;
            gap: 20px;
            margin: 20px 0;
            overflow: hidden;
            width: 100%;
            max-width: 100%;
            box-sizing: border-box;
        }

        .decoration {
            display: flex;
            flex-direction: column;
            gap: 15px;
            opacity: 0.6;
        }

        .decoration-item {
            background: linear-gradient(135deg, rgba(30, 58, 95, 0.4) 0%, rgba(44, 82, 130, 0.4) 100%);
            padding: 15px;
            border-radius: 12px;
            border: 2px solid rgba(96, 165, 250, 0.2);
            font-size: 2rem;
            display: flex;
            align-items: center;
            justify-content: center;
            backdrop-filter: blur(10px);
        }

        /* Tablero principal */
        .board-container {
            display: flex;
            justify-content: center;
            position: relative;
            width: 100%;
            max-width: 100%;
            box-sizing: border-box;
            overflow: hidden;
            padding: 0 5px;
        }

        .board {
            display: grid;
            grid-template-columns: repeat(8, 1fr);
            gap: 8px;
            background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
            padding: 20px;
            border-radius: 20px;
            max-width: min(480px, 100%); /* Límite de ancho para tablero no muy grande */
            width: 100%;
            /* Altura automática basada en las celdas (aspect-ratio: 1) */
            /* El grid se auto-ajusta a 8 filas de altura igual al ancho de cada celda */
            box-shadow: 
                0 12px 40px rgba(0, 0, 0, 0.4),
                inset 0 0 40px rgba(0, 0, 0, 0.3);
            border: 3px solid rgba(96, 165, 250, 0.3);
            position: relative;
            box-sizing: border-box;
            margin: 0 auto;
        }

        .board::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: 
                radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.1) 0%, transparent 40%),
                radial-gradient(circle at 80% 70%, rgba(6, 182, 212, 0.1) 0%, transparent 40%);
            border-radius: 20px;
            pointer-events: none;
        }

        @media (max-width: 1024px) {
            .decoration-item {
                font-size: 1.5rem;
                padding: 12px;
            }
        }

        @media (max-width: 900px) {
            .decoration {
                display: none;
            }
            
            .board-container {
                padding: 0 10px;
            }

            .board {
                max-width: min(440px, 100%);
                width: 100%;
                padding: 15px;
                gap: 6px;
            }
        }

        .cell {
            aspect-ratio: 1; /* Mantiene celdas cuadradas */
            background: linear-gradient(135deg, #2c5282 0%, #3b6ba8 100%);
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: grab;
            transition: all 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
            border: 3px solid rgba(96, 165, 250, 0.4);
            box-shadow: 
                0 4px 12px rgba(0, 0, 0, 0.3),
                inset 0 2px 8px rgba(255, 255, 255, 0.1);
            user-select: none;
            position: relative;
            touch-action: none;
            padding: 10%;
            width: 100%;
            box-sizing: border-box;
            /* Tamaño mínimo para que las piezas sean jugables */
            min-width: 30px;
            min-height: 30px;
        }

        .cell::before {
            content: '';
            position: absolute;
            top: 3px;
            left: 3px;
            right: 3px;
            height: 40%;
            background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
            border-radius: 8px 8px 0 0;
            pointer-events: none;
        }
        
        .tile-image {
            width: 100%;
            height: 100%;
            object-fit: contain;
            pointer-events: none;
            position: relative;
            z-index: 1;
        }

        .cell:hover {
            transform: scale(1.05);
            border-color: rgba(96, 165, 250, 0.8);
            box-shadow: 
                0 6px 16px rgba(0, 0, 0, 0.4),
                0 0 20px rgba(96, 165, 250, 0.3);
        }

        .cell:active {
            cursor: grabbing;
            transform: scale(0.95);
        }

        .cell.dragging {
            opacity: 0.6;
            cursor: grabbing;
            transform: scale(0.9);
        }

        .cell.drag-over {
            border-color: #fbbf24;
            box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.5), 0 0 30px rgba(251, 191, 36, 0.4);
            transform: scale(1.1);
        }

        .drag-ghost {
            position: fixed;
            pointer-events: none;
            z-index: 1000;
            transform: translate(-50%, -50%);
            opacity: 0.95;
            filter: drop-shadow(0 8px 16px rgba(0,0,0,0.5)) brightness(1.2);
            max-width: 70px !important;
            max-height: 70px !important;
            width: 70px !important;
            height: 70px !important;
            padding: 8px !important;
        }
        
        .drag-ghost .tile-image {
            width: 100% !important;
            height: 100% !important;
            max-width: 100% !important;
            max-height: 100% !important;
            object-fit: contain !important;
        }

        @keyframes drag-float {
            0%, 100% { 
                transform: translate(-50%, -50%) rotate(-2deg); 
                filter: drop-shadow(0 8px 16px rgba(0,0,0,0.5)) brightness(1.2);
            }
            50% { 
                transform: translate(-50%, -50%) rotate(2deg); 
                filter: drop-shadow(0 10px 20px rgba(0,0,0,0.6)) brightness(1.25);
            }
        }

        .drag-trail {
            position: fixed;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            pointer-events: none;
            z-index: 999;
            animation: trail-fade 0.8s ease-out forwards;
            box-shadow: 0 0 10px currentColor;
        }

        @keyframes trail-fade {
            0% {
                transform: translate(-50%, -50%) scale(1);
                opacity: 0.9;
            }
            100% {
                transform: translate(-50%, -50%) scale(0);
                opacity: 0;
            }
        }

        .cell.selected {
            border-color: #fbbf24;
            box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.7), 0 0 30px rgba(251, 191, 36, 0.8);
            animation: pulse-select 0.8s ease-in-out infinite;
            z-index: 10;
            background: rgba(251, 191, 36, 0.15);
        }
        
        .cell.selected .tile-image {
            filter: brightness(1.3) drop-shadow(0 0 10px rgba(251, 191, 36, 0.9));
        }

        @keyframes pulse-select {
            0%, 100% { 
                box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.7), 0 0 30px rgba(251, 191, 36, 0.8);
            }
            50% { 
                box-shadow: 0 0 0 6px rgba(251, 191, 36, 0.7), 0 0 40px rgba(251, 191, 36, 0.8);
            }
        }
        
        .cell.hint-glow {
            animation: hint-glow 1.5s ease-in-out 3 !important;
        }
        
        @keyframes hint-glow {
            0%, 100% { 
                transform: scale(1);
                box-shadow: 0 0 0 4px #22c55e, 0 0 25px rgba(34, 197, 94, 0.6);
            }
            50% { 
                transform: scale(1.2);
                box-shadow: 0 0 0 6px #22c55e, 0 0 40px rgba(34, 197, 94, 0.9);
            }
        }

        .cell.matched {
            animation: match-pop 0.5s ease-out forwards;
        }

        @keyframes match-pop {
            0% { 
                transform: scale(1); 
                opacity: 1; 
            }
            50% { 
                transform: scale(1.3) rotate(15deg); 
                filter: brightness(1.5);
            }
            100% { 
                transform: scale(0) rotate(45deg); 
                opacity: 0; 
            }
        }

        .cell.falling {
            animation: fall 0.5s ease-in;
        }

        @keyframes fall {
            from { 
                transform: translateY(-150px) rotate(-180deg); 
                opacity: 0; 
            }
            to { 
                transform: translateY(0) rotate(0deg); 
                opacity: 1; 
            }
        }

        .cell.wrong {
            animation: shake 0.5s ease-in-out;
        }

        @keyframes shake {
            0%, 100% { transform: translateX(0) rotate(0deg); }
            20% { transform: translateX(-8px) rotate(-8deg); }
            40% { transform: translateX(8px) rotate(8deg); }
            60% { transform: translateX(-8px) rotate(-8deg); }
            80% { transform: translateX(8px) rotate(8deg); }
        }

        .points-popup {
            position: fixed;
            font-size: 1.8rem;
            font-weight: 900;
            color: #fbbf24;
            pointer-events: none;
            z-index: 1000;
            animation: float-up 1.2s ease-out forwards;
            text-shadow: 
                0 0 10px rgba(251, 191, 36, 0.8),
                2px 2px 4px rgba(0,0,0,0.5);
        }

        @keyframes float-up {
            0% { 
                transform: translate(-50%, 0) scale(1); 
                opacity: 1; 
            }
            100% { 
                transform: translate(-50%, -100px) scale(1.8); 
                opacity: 0; 
            }
        }

        .combo-badge {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 3rem;
            font-weight: 900;
            color: #fbbf24;
            pointer-events: none;
            z-index: 1001;
            animation: combo-pop 1s ease-out forwards;
            text-shadow: 
                0 0 20px rgba(251, 191, 36, 1),
                3px 3px 6px rgba(0,0,0,0.6);
            background: linear-gradient(135deg, rgba(30, 58, 95, 0.95) 0%, rgba(44, 82, 130, 0.95) 100%);
            padding: 25px 40px;
            border-radius: 20px;
            border: 3px solid #fbbf24;
            backdrop-filter: blur(10px);
        }

        @keyframes combo-pop {
            0% { 
                transform: translate(-50%, -50%) scale(0) rotate(-180deg); 
                opacity: 0; 
            }
            50% { 
                transform: translate(-50%, -50%) scale(1.15) rotate(5deg); 
                opacity: 1; 
            }
            100% { 
                transform: translate(-50%, -50%) scale(1) rotate(0deg); 
                opacity: 0; 
            }
        }

        /* Power-ups Section */
        .powerups-section {
            display: flex;
            justify-content: center;
            gap: 15px;
            margin: 25px auto;
            flex-wrap: wrap;
            width: 100%;
            max-width: min(540px, 100%);
            box-sizing: border-box;
            padding: 0 10px;
        }

        .powerup-item {
            background: linear-gradient(135deg, rgba(30, 58, 95, 0.7) 0%, rgba(44, 82, 130, 0.7) 100%);
            border: 2px solid rgba(96, 165, 250, 0.3);
            border-radius: 15px;
            padding: 15px 20px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            cursor: pointer;
            backdrop-filter: blur(10px);
            transition: all 0.3s;
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
            position: relative;
            overflow: hidden;
            min-width: 120px;
            flex: 1 1 auto;
        }

        .powerup-item::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
            opacity: 0;
            transition: opacity 0.3s;
        }

        .powerup-item:hover::before {
            opacity: 1;
        }

        .powerup-item:not(.disabled):hover {
            transform: translateY(-5px) scale(1.05);
            box-shadow: 0 10px 30px rgba(96, 165, 250, 0.5), 0 0 20px rgba(96, 165, 250, 0.3);
            border-color: rgba(96, 165, 250, 0.9);
        }

        .powerup-item:not(.disabled):active {
            transform: translateY(-2px) scale(1.02);
        }

        .powerup-item.disabled {
            opacity: 0.4;
            cursor: not-allowed;
            filter: grayscale(0.8) brightness(0.7);
            background: linear-gradient(135deg, rgba(30, 58, 95, 0.4) 0%, rgba(44, 82, 130, 0.4) 100%);
        }

        .powerup-item.disabled:hover {
            transform: none;
            border-color: rgba(96, 165, 250, 0.3);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
        }
        
        @keyframes unlockPulse {
            0%, 100% { 
                transform: scale(1); 
                box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
            }
            50% { 
                transform: scale(1.1); 
                box-shadow: 0 10px 30px rgba(34, 197, 94, 0.6);
            }
        }

        .powerup-icon-large {
            font-size: 3rem;
            filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
            position: relative;
            z-index: 1;
        }

        .powerup-label {
            font-size: 0.75rem;
            font-weight: 800;
            letter-spacing: 0.5px;
            text-transform: uppercase;
            color: white;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
            position: relative;
            z-index: 1;
        }

        .powerup-item.special {
            background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
            border-color: rgba(220, 38, 38, 0.6);
        }

        .powerup-item.special:hover {
            box-shadow: 0 10px 30px rgba(220, 38, 38, 0.5);
            border-color: rgba(220, 38, 38, 0.9);
        }

        /* Controles */
        .controls {
            margin-top: 20px;
            margin-left: auto;
            margin-right: auto;
            text-align: center;
            display: flex;
            gap: 15px;
            justify-content: center;
            flex-wrap: wrap;
            width: 100%;
            max-width: min(540px, 100%);
            box-sizing: border-box;
        }

        .control-btn {
            position: relative;
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 14px 28px;
            border: none;
            border-radius: 15px;
            font-size: 1rem;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
            backdrop-filter: blur(10px);
            overflow: hidden;
            text-transform: none !important;
        }

        .control-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%);
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .control-btn:hover::before {
            opacity: 1;
        }

        .control-btn:hover {
            transform: translateY(-3px) scale(1.03);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
        }

        .control-btn:active {
            transform: translateY(-1px) scale(1);
        }

        .btn-icon {
            font-size: 1.3rem;
            display: flex;
            align-items: center;
            justify-content: center;
            filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
        }

        .btn-text {
            position: relative;
            z-index: 1;
        }

        /* Nuevo Juego Button */
        .new-game-btn {
            background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
            color: white;
            border: 2px solid rgba(6, 182, 212, 0.4);
        }

        .new-game-btn:hover {
            background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
            border-color: rgba(6, 182, 212, 0.6);
            box-shadow: 0 8px 25px rgba(6, 182, 212, 0.5);
        }

        /* Hint Button */
        .hint-btn {
            background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
            color: white;
            border: 2px solid rgba(251, 191, 36, 0.4);
        }

        .hint-btn:hover {
            background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
            border-color: rgba(251, 191, 36, 0.6);
            box-shadow: 0 8px 25px rgba(251, 191, 36, 0.5);
        }

        .hint-btn:disabled {
            background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
        }

        .hint-btn:disabled:hover {
            transform: none;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
        }

        /* Animaciones de entrada */
        @keyframes slideInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .control-btn {
            animation: slideInUp 0.5s ease-out backwards;
        }

        .new-game-btn {
            animation-delay: 0.1s;
        }

        .hint-btn {
            animation-delay: 0.2s;
        }

        /* Efecto de pulso para el botón de pista cuando está disponible */
        @keyframes pulse-glow {
            0%, 100% {
                box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
            }
            50% {
                box-shadow: 0 4px 20px rgba(251, 191, 36, 0.6), 0 0 30px rgba(251, 191, 36, 0.3);
            }
        }

        .hint-btn:not(:disabled) {
            animation: pulse-glow 2s ease-in-out infinite;
        }

        .hint-btn:not(:disabled):hover {
            animation: none;
        }

        /* Estilos de botones scoped al juego para evitar conflictos con Bootstrap navbar */
        .game-container button,
        #instructionsModal button,
        .menu-overlay button {
            background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
            color: white;
            border: 2px solid rgba(96, 165, 250, 0.5);
            padding: 12px 28px;
            border-radius: 10px;
            font-size: 0.95rem;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.3s;
            box-shadow: 0 4px 15px rgba(0,0,0,0.3);
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .game-container button:hover,
        #instructionsModal button:hover,
        .menu-overlay button:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
            border-color: rgba(96, 165, 250, 0.8);
        }

        button:active {
            transform: translateY(0);
        }

        button:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none !important;
        }

        #hintBtn {
            position: relative;
            overflow: hidden;
            background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
            border-color: rgba(34, 197, 94, 0.5);
        }

        #hintBtn:hover {
            box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
            border-color: rgba(34, 197, 94, 0.8);
        }

        #hintBtn.used {
            animation: button-flash 0.3s ease;
        }

        @keyframes button-flash {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-2px) scale(1.05); box-shadow: 0 0 25px rgba(34, 197, 94, 0.8); }
        }

        .level-selector {
            background: linear-gradient(135deg, rgba(30, 58, 95, 0.6) 0%, rgba(44, 82, 130, 0.6) 100%);
            backdrop-filter: blur(15px);
            padding: 15px;
            border-radius: 12px;
            margin: 20px auto 15px auto;
            text-align: center;
            border: 2px solid rgba(96, 165, 250, 0.3);
            width: 100%;
            max-width: min(540px, 100%);
            box-sizing: border-box;
        }

        .level-selector label {
            color: #ffffff;
        }

        .level-progress {
            display: flex;
            justify-content: center;
            gap: 10px;
            margin-top: 15px;
            flex-wrap: wrap;
        }

        .level-badge {
            width: 45px;
            height: 45px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            font-size: 1.1rem;
            transition: all 0.3s;
            border: 2px solid rgba(255,255,255,0.3);
            cursor: pointer;
        }

        .level-badge.unlocked {
            background: linear-gradient(135deg, #22c55e, #16a34a);
            color: white;
            border-color: #22c55e;
            box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
        }

        .level-badge.unlocked:hover {
            transform: scale(1.1);
            box-shadow: 0 6px 16px rgba(34, 197, 94, 0.6);
        }

        .level-badge.locked {
            background: rgba(71, 85, 105, 0.4);
            color: rgba(255, 255, 255, 0.4);
            border-color: rgba(255,255,255,0.2);
            cursor: not-allowed;
        }

        .level-badge.current {
            background: linear-gradient(135deg, #3b82f6, #60a5fa);
            border-color: #3b82f6;
            box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
            animation: pulse-badge 2s ease-in-out infinite;
        }

        @keyframes pulse-badge {
            0%, 100% { 
                transform: scale(1); 
                box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
            }
            50% { 
                transform: scale(1.1); 
                box-shadow: 0 6px 20px rgba(59, 130, 246, 0.8);
            }
        }

        /* Menú Hamburguesa Flotante */
        /* Menú Hamburguesa */
        .hamburger-menu {
            position: fixed;
            top: 80px;
            right: 20px;
            z-index: 1500;
        }
        
        /* En desktop sigue flotante */
        @media (min-width: 769px) {
            .hamburger-menu {
                position: fixed;
                top: 80px;
                right: 20px;
            }
        }

        .hamburger-btn {
            width: 50px;
            height: 50px;
            background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
            border: 2px solid rgba(96, 165, 250, 0.5);
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            gap: 5px;
            padding: 10px;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
            opacity: 0.85;
        }

        .hamburger-btn:hover {
            transform: scale(1.1);
            box-shadow: 0 6px 20px rgba(96, 165, 250, 0.5);
            border-color: rgba(96, 165, 250, 0.8);
            opacity: 1;
        }

        .hamburger-btn span {
            width: 25px;
            height: 3px;
            background: white;
            border-radius: 2px;
            transition: all 0.3s ease;
        }

        .hamburger-btn.active span:nth-child(1) {
            transform: rotate(45deg) translate(7px, 7px);
        }

        .hamburger-btn.active span:nth-child(2) {
            opacity: 0;
        }

        .hamburger-btn.active span:nth-child(3) {
            transform: rotate(-45deg) translate(7px, -7px);
        }

        .menu-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.9);
            backdrop-filter: blur(10px);
            z-index: 1600;
            display: none;
            opacity: 0;
            transition: opacity 0.3s ease;
            overflow-y: auto;
            padding: 20px;
        }

        .menu-overlay.active {
            display: flex;
            opacity: 1;
            justify-content: center;
            align-items: flex-start;
            padding-top: 40px;
        }

        .menu-content {
            background: linear-gradient(135deg, #1e3a5f 0%, #3b82f6 100%);
            padding: 40px;
            border-radius: 20px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
            max-width: 400px;
            width: 90%;
            transform: scale(0.9);
            transition: transform 0.3s ease;
            border: 3px solid #60a5fa;
            max-height: 90vh;
            overflow-y: auto;
            margin: auto;
        }

        .menu-overlay.active .menu-content {
            transform: scale(1);
        }
        
        /* Scrollbar personalizado para el menú */
        .menu-content::-webkit-scrollbar {
            width: 10px;
        }

        .menu-content::-webkit-scrollbar-track {
            background: rgba(0, 0, 0, 0.2);
            border-radius: 10px;
        }

        .menu-content::-webkit-scrollbar-thumb {
            background: rgba(96, 165, 250, 0.5);
            border-radius: 10px;
        }

        .menu-content::-webkit-scrollbar-thumb:hover {
            background: rgba(96, 165, 250, 0.7);
        }

        .menu-title {
            font-size: 2rem;
            font-weight: 700;
            margin-bottom: 30px;
            text-align: center;
            color: white;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
        }

        .menu-items {
            display: flex;
            flex-direction: column;
            gap: 15px;
        }

        .menu-item {
            background: rgba(255, 255, 255, 0.2);
            border: 2px solid rgba(255, 255, 255, 0.3);
            color: white;
            padding: 15px 25px;
            border-radius: 12px;
            font-size: 1.1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            text-align: center;
            text-decoration: none;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
        }

        .menu-item:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: translateX(5px);
            border-color: rgba(255, 255, 255, 0.5);
        }

        .menu-item:active {
            transform: translateX(5px) scale(0.98);
        }

        @media (max-width: 768px) {
            .game-wrapper {
                padding: 10px;
                padding-top: 75px; /* Espacio para navbar en tablets */
            }

            .top-header {
                flex-wrap: wrap;
                gap: 10px;
                padding: 10px 15px;
                width: 100%;
                max-width: min(500px, 100%);
            }

            .moves-badge {
                padding: 8px 15px;
                min-width: 80px;
            }

            .moves-value {
                font-size: 1.2rem;
            }

            .board {
                gap: 6px;
                padding: 12px;
                max-width: min(400px, 100%);
                width: 100%;
                margin: 0 auto;
            }
            
            .board-wrapper {
                margin: 10px 0;
                padding: 0;
                overflow: hidden;
                width: 100%;
                max-width: 100%;
                box-sizing: border-box;
            }

            .cell {
                border-width: 2px;
            }
            
            .drag-ghost {
                max-width: 60px !important;
                max-height: 60px !important;
                width: 60px !important;
                height: 60px !important;
                padding: 6px !important;
            }
            
            .cell.selected {
                background: rgba(251, 191, 36, 0.2);
                border-width: 3px;
            }
            
            .cell.selected .tile-image {
                filter: brightness(1.4) drop-shadow(0 0 12px rgba(251, 191, 36, 1));
            }
            
            @keyframes pulse-select {
                0%, 100% { 
                    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.7), 0 0 25px rgba(251, 191, 36, 0.8);
                }
                50% { 
                    box-shadow: 0 0 0 5px rgba(251, 191, 36, 0.9), 0 0 35px rgba(251, 191, 36, 1);
                }
            }

            .powerups-section {
                gap: 10px;
                max-width: min(500px, 100%);
            }

            .powerup-item {
                min-width: 110px;
                padding: 12px 15px;
            }

            .powerup-icon-large {
                font-size: 2.5rem;
            }

            .powerup-label {
                font-size: 0.65rem;
            }

            .hamburger-menu {
                position: static;
                top: auto;
                right: auto;
                margin: 0 auto;
                margin-bottom: 12px;
                width: 100%;
                max-width: 100%;
                padding: 12px 0;
                border-bottom: 2px solid rgba(96, 165, 250, 0.2);
                display: flex;
                justify-content: center;
                align-items: center;
            }
            
            .hamburger-btn {
                width: 40px;
                height: 40px;
                padding: 8px;
                opacity: 1;
                background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
                border-width: 2px;
                box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
            }
            
            .hamburger-btn:hover {
                transform: scale(1.05);
            }
            
            .hamburger-btn span {
                width: 20px;
                height: 2.5px;
            }
            
            .hamburger-btn.active {
                opacity: 1;
            }

            .menu-overlay {
                padding: 15px;
                padding-top: 20px;
            }
            
            .menu-overlay.active {
                padding-top: 20px;
            }
            
            .menu-content {
                padding: 25px 18px;
                max-height: 85vh;
            }

            .menu-title {
                font-size: 1.5rem;
                margin-bottom: 20px;
            }

            .menu-item {
                padding: 12px 20px;
                font-size: 1rem;
            }

            .instructions p {
                font-size: 0.85rem;
            }
            
            .menu-content::-webkit-scrollbar {
                width: 8px;
            }
            
            #instructionsModal.modal {
                padding: 70px 20px 20px 20px;
            }
            
            #instructionsModal .modal-content {
                padding: 50px 20px 30px 20px;
                max-width: 90%;
                max-height: calc(100vh - 90px);
            }
            
            .modal-close {
                top: 8px;
                right: 8px;
                width: 30px;
                height: 30px;
                font-size: 1.6rem;
            }
        }

        /* Media query específico para iPhone y móviles pequeños */
        @media (max-width: 480px) {
            * {
                box-sizing: border-box;
            }
            
            html, body {
                overflow-x: hidden;
                max-width: 100%;
                width: 100%;
            }
            
            .game-wrapper {
                padding: 10px;
                padding-top: 75px;
                padding-bottom: 15px;
                width: 100%;
                max-width: 100%;
                overflow-x: hidden;
                box-sizing: border-box;
            }
            
            .hamburger-menu {
                position: fixed;
                top: 70px;
                right: 15px;
                margin: 0;
                width: auto;
                max-width: auto;
                padding: 0;
                border-bottom: none;
                display: block;
                z-index: 1500;
            }
            
            .hamburger-btn {
                width: 40px;
                height: 40px;
                padding: 8px;
                opacity: 0.95;
                box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
                border-width: 2px;
            }
            
            .hamburger-btn:hover {
                transform: scale(1.08);
                opacity: 1;
            }
            
            .hamburger-btn span {
                width: 20px;
                height: 2.5px;
            }
            
            .hamburger-btn:active {
                transform: scale(0.92);
            }
            
            .menu-overlay {
                padding: 10px;
                padding-top: 15px;
            }
            
            .menu-overlay.active {
                padding-top: 15px;
            }
            
            .menu-content {
                padding: 20px 15px;
                max-height: 88vh;
            }
            
            .menu-content::-webkit-scrollbar {
                width: 6px;
            }
            
            .top-header {
                flex-direction: column;
                width: 100%;
                max-width: min(440px, 100%);
                padding: 10px;
                box-sizing: border-box;
                margin-bottom: 10px;
            }

            .progress-section {
                width: 100%;
                box-sizing: border-box;
            }
            
            .objectives {
                gap: 0.5rem !important;
            }
            
            .header-games-logo {
                margin: 5px 0;
            }
            
            .header-games-logo .logos-games {
                max-width: 200px !important;
            }
            
            .board-container {
                width: 100%;
                max-width: 100%;
                padding: 0;
                box-sizing: border-box;
                overflow: hidden;
            }

            .board {
                padding: 8px;
                gap: 4px;
                max-width: min(380px, 100%);
                width: 100%;
                margin: 0 auto;
                box-sizing: border-box;
                border-width: 2px;
            }
            
            .cell {
                padding: 8%;
                border-width: 2px;
            }
            
            .drag-ghost {
                max-width: 55px !important;
                max-height: 55px !important;
                width: 55px !important;
                height: 55px !important;
                padding: 6px !important;
            }
            
            .cell.selected {
                /* Sin transform para mantener proporción */
            }
            
            @keyframes pulse-select {
                0%, 100% { 
                    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.5), 0 0 20px rgba(251, 191, 36, 0.6);
                }
                50% { 
                    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.7), 0 0 25px rgba(251, 191, 36, 0.8);
                }
            }

            .powerups-section {
                flex-direction: row;
                justify-content: space-around;
                gap: 8px;
                padding: 0;
                margin: 15px auto;
                max-width: min(440px, 100%);
            }

            .powerup-item {
                min-width: 0;
                flex: 1;
                padding: 10px 8px;
                gap: 4px;
            }
            
            .powerup-icon-large {
                font-size: 2rem;
            }
            
            .powerup-label {
                font-size: 0.7rem;
            }
            
            .controls {
                gap: 8px;
                padding: 0;
                margin-top: 12px;
            }
            
            .control-btn {
                padding: 10px 16px;
                font-size: 0.8rem;
                flex: 1;
                min-width: 0;
            }
            
            .btn-text {
                font-size: 0.75rem;
            }
            
            #instructionsModal.modal {
                padding: 65px 15px 15px 15px;
            }
            
            #instructionsModal .modal-content {
                padding: 45px 20px 25px 20px;
                max-width: 95%;
                max-height: calc(100vh - 80px);
            }
            
            .modal-close {
                top: 8px;
                right: 8px;
                width: 28px;
                height: 28px;
                font-size: 1.5rem;
            }
        }

        /* Media query para pantallas pequeñas de altura */
        @media (max-height: 700px) {
            .game-wrapper {
                padding: 10px;
                padding-top: 70px; /* Espacio para navbar en móviles */
                padding-bottom: max(20px, env(safe-area-inset-bottom)); /* Safe area para iPhone */
                overflow-y: visible;
                overflow-x: hidden;
                max-width: 100%;
                width: 100%;
                box-sizing: border-box;
            }

            .top-header {
                padding: 10px;
                margin-bottom: 10px;
                box-sizing: border-box;
                max-width: min(420px, 100%);
            }
            
            .objectives {
                gap: 0.4rem !important;
            }

            .board-container {
                margin: 8px 0;
                padding: 0;
                overflow: hidden;
                width: 100%;
                max-width: 100%;
                box-sizing: border-box;
            }

            .board {
                padding: 10px;
                gap: 4px;
                max-width: min(360px, 100%);
                width: 100%;
                margin: 0 auto;
                box-sizing: border-box;
                border-width: 2px;
            }

            .cell {
                padding: 8%;
                border-width: 2px;
            }

            .powerups-section {
                margin: 10px auto;
                gap: 5px;
                padding: 0;
                max-width: min(400px, 100%);
            }
            
            .controls {
                max-width: min(400px, 100%);
            }
            
            .level-selector {
                max-width: min(400px, 100%);
            }

            .powerup-item {
                padding: 10px 15px;
                min-width: 120px;
            }

            .powerup-icon-large {
                font-size: 2.2rem;
            }

            .controls {
                margin-top: 15px;
                gap: 12px;
            }

            .control-btn {
                padding: 12px 24px;
                font-size: 0.9rem;
                gap: 8px;
            }

            .btn-icon {
                font-size: 1.2rem;
            }

            .game-container button:not(.control-btn),
            #instructionsModal button,
            .menu-overlay button {
                padding: 10px 24px;
                font-size: 0.9rem;
            }

            .instructions {
                padding: 15px;
                margin-top: 15px;
            }

            .instructions p {
                font-size: 0.85rem;
                margin: 6px 0;
            }

            .level-selector {
                padding: 10px;
                margin: 10px auto;
                box-sizing: border-box;
                max-width: min(440px, 100%);
            }
            
            .level-progress {
                gap: 6px;
            }
            
            #instructionsModal.modal {
                padding: 65px 15px 15px 15px;
            }
            
            #instructionsModal .modal-content {
                padding: 45px 20px 25px 20px;
                max-height: calc(100vh - 80px);
            }
        }

        @media (max-height: 600px) {
            .game-wrapper {
                padding: 8px;
                padding-top: 65px; /* Espacio para navbar en móviles pequeños */
                padding-bottom: max(20px, env(safe-area-inset-bottom)); /* Safe area para iPhone */
                overflow-y: visible;
                overflow-x: hidden;
                max-width: 100%;
                width: 100%;
                box-sizing: border-box;
            }

            .top-header {
                padding: 8px;
                gap: 8px;
                box-sizing: border-box;
                max-width: min(400px, 100%);
            }
            
            .objectives {
                gap: 0.3rem !important;
            }
            
            .objective-badge {
                font-size: 0.85rem;
            }
            
            .board-container {
                padding: 0;
                box-sizing: border-box;
                overflow: hidden;
            }

            .board {
                padding: 8px;
                gap: 4px;
                max-width: min(340px, 100%);
                width: 100%;
                margin: 0 auto;
                box-sizing: border-box;
            }

            .cell {
                /* Imágenes se ajustan automáticamente */
            }
            
            .drag-ghost {
                max-width: 50px !important;
                max-height: 50px !important;
                width: 50px !important;
                height: 50px !important;
                padding: 5px !important;
            }
            
            .cell.selected {
                background: rgba(251, 191, 36, 0.25);
                border-width: 2.5px;
            }
            
            .cell.selected .tile-image {
                filter: brightness(1.5) drop-shadow(0 0 10px rgba(251, 191, 36, 1));
            }
            
            @keyframes pulse-select {
                0%, 100% {
                    box-shadow: 0 0 0 2.5px rgba(251, 191, 36, 0.7), 0 0 20px rgba(251, 191, 36, 0.8);
                }
                50% {
                    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.9), 0 0 30px rgba(251, 191, 36, 1);
                }
            }

            .powerups-section {
                margin: 10px auto;
                gap: 6px;
                padding: 0;
                max-width: min(420px, 100%);
            }
            
            .controls {
                max-width: min(420px, 100%);
            }
            
            .level-selector {
                max-width: min(420px, 100%);
            }

            .powerup-item {
                padding: 8px 6px;
                min-width: 0;
                flex: 1;
                max-width: 33%;
            }

            .powerup-icon-large {
                font-size: 1.8rem;
            }
            
            .powerup-label {
                font-size: 0.7rem;
                text-align: center;
            }

            .controls {
                margin-top: 10px;
                gap: 8px;
                padding: 0;
            }

            .control-btn {
                padding: 10px 18px;
                font-size: 0.8rem;
                gap: 6px;
                border-radius: 12px;
                flex: 1;
                min-width: 120px;
                max-width: 48%;
            }

            .btn-icon {
                font-size: 1.1rem;
            }

            .game-container button:not(.control-btn),
            #instructionsModal button,
            .menu-overlay button {
                padding: 8px 20px;
                font-size: 0.85rem;
            }

            .instructions {
                padding: 12px;
                margin-top: 12px;
            }

            .instructions p {
                font-size: 0.8rem;
                margin: 4px 0;
            }

            .decoration-item {
                display: none;
            }
            
            #instructionsModal.modal {
                padding: 60px 10px 10px 10px;
            }
            
            #instructionsModal .modal-content {
                padding: 40px 15px 20px 15px;
                max-height: calc(100vh - 70px);
                font-size: 0.95rem;
            }
            
            #instructionsModal .modal-content h2 {
                font-size: 1.8rem;
                margin-bottom: 10px;
            }
            
            #instructionsModal .modal-content h3 {
                font-size: 1.1rem;
            }
            
            #instructionsModal .modal-content button {
                padding: 12px 25px;
                font-size: 1rem;
            }
            
            .modal-close {
                top: 6px;
                right: 6px;
                width: 26px;
                height: 26px;
                font-size: 1.4rem;
            }
        }

        .instructions {
            background: linear-gradient(135deg, rgba(30, 58, 95, 0.8) 0%, rgba(44, 82, 130, 0.8) 100%);
            backdrop-filter: blur(15px);
            padding: 20px;
            border-radius: 12px;
            margin-top: 20px;
            text-align: center;
            border: 2px solid rgba(96, 165, 250, 0.3);
        }

        .instructions p {
            margin: 8px 0;
            font-size: 0.9rem;
            color: rgba(255, 255, 255, 0.9);
            line-height: 1.5;
        }

        .instructions strong {
            color: #60a5fa;
            font-weight: 700;
        }

        /* Estilos del modal personalizados eliminados - ahora usando Bootstrap 5 modal */
        /* Los estilos del instructionsModal se mantienen separados */
        #instructionsModal.modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.9);
            justify-content: center;
            align-items: flex-start;
            z-index: 1700;
            backdrop-filter: blur(10px);
            overflow-y: auto;
            padding: 80px 20px 20px 20px;
        }

        #instructionsModal.modal.active {
            display: flex;
            animation: fadeIn 0.3s ease;
        }

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

        #instructionsModal .modal-content {
            background: linear-gradient(135deg, #1e3a5f 0%, #3b82f6 100%);
            padding: 60px 40px 40px 40px;
            border-radius: 20px;
            text-align: center;
            color: white;
            max-width: 650px;
            width: 90%;
            max-height: calc(100vh - 100px);
            overflow-y: auto;
            animation: slideInDown 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
            box-shadow: 0 20px 60px rgba(0,0,0,0.7);
            border: 3px solid #60a5fa;
            margin: 0 auto;
            position: relative;
        }
        
        @keyframes slideInDown {
            from {
                opacity: 0;
                transform: translateY(-50px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .modal-content::-webkit-scrollbar {
            width: 10px;
        }
        
        .modal-content::-webkit-scrollbar-track {
            background: rgba(255, 255, 255, 0.1);
            border-radius: 10px;
        }
        
        .modal-content::-webkit-scrollbar-thumb {
            background: rgba(96, 165, 250, 0.6);
            border-radius: 10px;
        }
        
        .modal-content::-webkit-scrollbar-thumb:hover {
            background: rgba(96, 165, 250, 0.8);
        }

        @keyframes slideIn {
            from {
                transform: translateY(-80px) scale(0.8);
                opacity: 0;
            }
            to {
                transform: translateY(0) scale(1);
                opacity: 1;
            }
        }

        .modal-content h2 {
            margin-bottom: 15px;
            font-size: 2.5rem;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
        }

        .modal-content p {
            margin: 15px 0;
            font-size: 1.1rem;
            line-height: 1.6;
        }

        /* Estilos del instructionsModal */
        #instructionsModal .modal-stats {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
            margin: 25px 0;
        }

        #instructionsModal .modal-stat {
            background: rgba(255, 255, 255, 0.2);
            backdrop-filter: blur(10px);
            padding: 15px;
            border-radius: 12px;
            border: 2px solid rgba(255, 255, 255, 0.3);
        }

        #instructionsModal .modal-stat-label {
            font-size: 0.85rem;
            opacity: 0.9;
            margin-bottom: 5px;
        }

        #instructionsModal .modal-stat-value {
            font-size: 1.8rem;
            font-weight: 700;
            color: #fbbf24;
            text-shadow: 0 2px 4px rgba(0,0,0,0.3);
        }

        .modal-content button {
            background: linear-gradient(45deg, #dc2626, #991b1b);
            color: white;
            border: none;
            padding: 15px 35px;
            border-radius: 12px;
            font-size: 1.2rem;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.3s;
            margin-top: 0px;
            box-shadow: 0 6px 20px rgba(220, 38, 38, 0.5);
            text-transform: uppercase;
            letter-spacing: 1px;
            min-width: 40px;
        }

        .modal-content button:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 25px rgba(220, 38, 38, 0.7);
        }

        .modal-content button:active {
            transform: translateY(-1px);
        }

        /* Partículas de fondo */
        .sparkle {
            position: fixed;
            width: 4px;
            height: 4px;
            background: white;
            border-radius: 50%;
            pointer-events: none;
            z-index: 0;
            animation: sparkle-float 3s ease-in-out infinite;
        }

        @keyframes sparkle-float {
            0%, 100% {
                transform: translateY(0) scale(1);
                opacity: 0.3;
            }
            50% {
                transform: translateY(-20px) scale(1.5);
                opacity: 0.8;
            }
        }

        @keyframes pulse-warning {
            0%, 100% { 
                transform: scale(1); 
                box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
            }
            50% { 
                transform: scale(1.05); 
                box-shadow: 0 6px 20px rgba(220, 38, 38, 0.8);
            }
        }

        /* Efecto de brillo en celdas */
        .cell.glow {
            animation: cell-glow 0.6s ease-out;
        }

        @keyframes cell-glow {
            0% {
                box-shadow: 
                    0 4px 12px rgba(0, 0, 0, 0.3),
                    inset 0 2px 8px rgba(255, 255, 255, 0.1);
            }
            50% {
                box-shadow: 
                    0 0 30px rgba(251, 191, 36, 0.8),
                    0 0 50px rgba(251, 191, 36, 0.5),
                    inset 0 2px 8px rgba(255, 255, 255, 0.3);
                border-color: #fbbf24;
            }
            100% {
                box-shadow: 
                    0 4px 12px rgba(0, 0, 0, 0.3),
                    inset 0 2px 8px rgba(255, 255, 255, 0.1);
            }
        }

        @keyframes progress-complete {
            0%, 100% {
                box-shadow: 0 0 25px rgba(34, 197, 94, 0.9);
            }
            50% {
                box-shadow: 0 0 40px rgba(34, 197, 94, 1), 0 0 60px rgba(34, 197, 94, 0.6);
            }
        }

        /* Estilos específicos por tipo de pieza */
        .cell[data-type="0"] {
            /* Diente feliz - blanco brillante */
            background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
        }

        .cell[data-type="1"] {
            /* Bacteria - verde */
            background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
        }

        .cell[data-type="2"] {
            /* Pasta dental - rojo/blanco */
            background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
        }

        .cell[data-type="3"] {
            /* Cepillo - azul cyan */
            background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
        }

        .cell[data-type="4"] {
            /* Diamante/Gema - azul brillante */
            background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
        }

        .cell[data-type="5"] {
            /* Hilo dental - rosa/blanco */
            background: linear-gradient(135deg, #f9a8d4 0%, #ec4899 100%);
        }
        /* ===== AUTH TOAST ===== */
        #authToast {
            position: fixed;
            bottom: 24px;
            right: 24px;
            z-index: 9000;
            min-width: 320px;
            max-width: 380px;
            background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
            border: 1px solid rgba(96, 165, 250, 0.4);
            border-radius: 1rem;
            box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(96,165,250,0.1);
            color: white;
            font-family: 'Inter', sans-serif;
        }
        #authToast .toast-header {
            background: rgba(96, 165, 250, 0.1);
            border-bottom: 1px solid rgba(96, 165, 250, 0.2);
            border-radius: 1rem 1rem 0 0;
            color: #60a5fa;
            font-weight: 700;
            padding: 0.75rem 1rem;
        }
        #authToast .toast-body {
            padding: 1rem;
            font-size: 0.9rem;
            line-height: 1.5;
            color: rgba(255,255,255,0.9);
        }
        #authToast .btn-close {
            filter: invert(1) grayscale(1) brightness(2);
            opacity: 0.7;
        }
        #authToast .btn-close:hover { opacity: 1; }
        .auth-toast-actions {
            display: flex;
            gap: 0.5rem;
            margin-top: 0.75rem;
        }
        .auth-toast-actions .btn {
            flex: 1;
            font-size: 0.82rem;
            font-weight: 600;
            padding: 0.45rem 0.75rem;
            border-radius: 0.5rem;
            cursor: pointer;
        }
        @media (max-width: 480px) {
            #authToast {
                bottom: 12px;
                right: 12px;
                left: 12px;
                min-width: unset;
                max-width: unset;
            }
        }
    
/* === INLINE STYLE CLASSES (extracted from HTML) === */

/* Header game logo */
.dg-crash-logo {
    max-width: min(300px, 90%);
}

/* Progress bar init */
.dg-progress-init {
    width: 0%;
}

/* Combo next indicator (crash) */
.dg-combo-next-crash {
    font-size: 0.75rem;
    margin-left: 4px;
    color: rgba(255, 255, 255, 0.7);
}

/* Level info text */
.dg-level-info {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Menu logo image */
.dg-menu-logo-img {
    max-width: 150px;
    vertical-align: middle;
    margin-right: 10px;
}

/* Result modal (Bootstrap 5 override) */
.dg-result-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    overflow: hidden;
}

.dg-result-header {
    padding: 1.5rem;
    padding-bottom: 1rem;
}

.dg-result-title {
    font-size: 2rem;
    font-weight: 800;
    margin: 0;
}

.dg-result-body {
    padding: 1.5rem;
    padding-top: 0.5rem;
}

.dg-result-message {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.dg-result-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0;
}

.dg-result-stat {
    background: rgba(255, 255, 255, 0.15);
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
}

.dg-result-stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.dg-result-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.dg-result-footer {
    padding: 1.5rem;
    padding-top: 1rem;
    background: transparent;
}

.dg-result-btn {
    font-size: 1.2rem;
    padding: 0.8rem;
    font-weight: 600;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Instructions modal (crash) */
.dg-inst-content {
    max-width: 650px;
    position: relative;
}

.dg-inst-logo-wrap {
    text-align: center;
    margin-bottom: 1.5rem;
}

.dg-inst-logo-img {
    max-width: 300px;
    width: 80%;
    display: block;
    margin: 0 auto;
}

.dg-inst-subtitle {
    font-size: 1.1rem;
    margin-bottom: 25px;
}

.dg-inst-section {
    background: rgba(255, 255, 255, 0.15);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: left;
}

.dg-inst-section-title {
    color: #fbbf24;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.dg-inst-step {
    margin: 10px 0;
    font-size: 1rem;
}

.dg-inst-arrow {
    color: #60a5fa;
}

.dg-inst-powerup-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dg-inst-powerup-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dg-inst-powerup-img-wrap {
    width: 50px;
    height: 50px;
}

.dg-inst-powerup-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.dg-inst-powerup-title {
    color: #fbbf24;
}

.dg-inst-powerup-desc {
    font-size: 0.9rem;
}

.dg-inst-powerup-unlock {
    font-size: 0.85rem;
    color: #22c55e;
}

.dg-inst-combo-section {
    background: rgba(34, 197, 94, 0.2);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: left;
    border: 2px solid rgba(34, 197, 94, 0.4);
}

.dg-inst-combo-title {
    color: #22c55e;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.dg-inst-combo-text {
    margin: 8px 0;
    font-size: 0.95rem;
}

.dg-inst-combo-highlight {
    color: #fbbf24;
}

.dg-inst-start-btn {
    width: 100%;
    font-size: 1.3rem;
    padding: 18px;
}

/* Decoration image (inside commented-out sections but kept for class consistency) */
.dg-deco-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Auth toast inline styles (same as dental-invaders) */
.dg-rank-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.dg-rank-value {
    font-size: 2.5rem;
    margin-top: 0.3rem;
}

/* Register button inline style */
.dg-register-btn {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    color: white;
}
